Re: [SQL] postgres server crashes unexpectedly

2008-03-18 Thread Chadwick Horn
Hi there, Sorry about the lack of information on the system. We're running fedora (not for sure what version though) core (whitebox). I did as you said and this is the result: DETAIL: 0 index pages have been deleted, 0 are currently reusable. CPU 0.00s/0.00u sec elapsed 0.01 sec. INFO: "grp

Re: [SQL] postgres server crashes unexpectedly

2008-03-18 Thread Joshua Kramerý€€€„
On Tue, 18 Mar 2008, Chadwick Horn wrote: Sorry about the lack of information on the system. We're running fedora (not for sure what version though) core (whitebox). This may not matter in the least bit, but have you tried running the DB on a real RHEL, or CentOS box? The kernel and libs on

Re: [SQL] postgres server crashes unexpectedly

2008-03-18 Thread Chadwick Horn
In all honesty, we're fairly "trapped" on the box we have due to the depths of corporate approvals required to get something new online. I would, most def, prefer to be on anything BUT this... - Original Message - From: "Joshua Kramerý€€€„" <[EMAIL PROTECTED]> To: "Chadwick Horn" <[

Re: [SQL] postgres server crashes unexpectedly

2008-03-18 Thread Tom Lane
"Chadwick Horn" <[EMAIL PROTECTED]> writes: > I keep getting this error: > Attempting reset: WARNING: terminating connection because of crash of another > server process It looks to me like psql is managing to start a new connection before the postmaster notices the crash of the prior backend an

Re: [SQL] postgres server crashes unexpectedly

2008-03-18 Thread Chadwick Horn
"Chadwick Horn" <[EMAIL PROTECTED]> writes: I keep getting this error: Attempting reset: WARNING: terminating connection because of crash of another server process It looks to me like psql is managing to start a new connection before the postmaster notices the crash of the prior backend and

[SQL] Create on insert a unique random number

2008-03-18 Thread Campbell, Lance
When inserting a record is there a way to have postgres create a random number for a field such that it is unique? Thanks, Lance Campbell Project Manager/Software Architect Web Services at Public Affairs University of Illinois 217.333.0382 http://webservices.uiuc.edu

Re: [SQL] Create on insert a unique random number

2008-03-18 Thread chester c young
> When inserting a record is there a way to have postgres create a > random number for a field such that it is unique? you could use oid Looking for last minute shopping deals? Find them fast with Ya

Re: [SQL] Create on insert a unique random number

2008-03-18 Thread A. Kretschmer
am Tue, dem 18.03.2008, um 9:43:01 -0700 mailte chester c young folgendes: > > > When inserting a record is there a way to have postgres create a > > random number for a field such that it is unique? > > > you could use oid No! No oid, it's deprecated. The solution: use serial. Andreas --

Re: [SQL] Create on insert a unique random number

2008-03-18 Thread Campbell, Lance
I created the following table: create table xyz ( n serial, abc character varying, constraint n_pkey primary key (n)); Each time I do an insert: insert into xyz(abc) values('adf6'); The field n is not random but is sequential. Is there something I should do to make the serial number random?

Re: [SQL] Create on insert a unique random number

2008-03-18 Thread paul rivers
Campbell, Lance wrote: I created the following table: create table xyz ( n serial, abc character varying, constraint n_pkey primary key (n)); Each time I do an insert: insert into xyz(abc) values('adf6'); The field n is not random but is sequential. Is there something I should do to make

Re: [SQL] Create on insert a unique random number

2008-03-18 Thread D'Arcy J.M. Cain
On Tue, 18 Mar 2008 17:51:39 +0100 "A. Kretschmer" <[EMAIL PROTECTED]> wrote: > am Tue, dem 18.03.2008, um 9:43:01 -0700 mailte chester c young folgendes: > > > When inserting a record is there a way to have postgres create a > > > random number for a field such that it is unique? > > > > you co

Re: [SQL] Create on insert a unique random number

2008-03-18 Thread A. Kretschmer
am Tue, dem 18.03.2008, um 12:03:31 -0500 mailte Campbell, Lance folgendes: > I created the following table: > > create table xyz ( > n serial, > abc character varying, > constraint n_pkey primary key (n)); > > Each time I do an insert: > > insert into xyz(abc) values('adf6'); > > The field

Re: [SQL] Create on insert a unique random number

2008-03-18 Thread Vivek Khera
On Mar 18, 2008, at 1:03 PM, Campbell, Lance wrote: The field n is not random but is sequential. Is there something I should do to make the serial number random? Depending on your "randomness" need, you can alter the increment of the sequence so it changes by a different amount than "1" on

Re: [SQL] Create on insert a unique random number

2008-03-18 Thread Campbell, Lance
Thanks for all of your input. It appears that the best way to do this is to create a default random number in the primary id field in the table definition and then return that value after insert. If an exception occurs because of duplicates I will simple perform the same insert statement again. I

Re: [SQL] postgres server crashes unexpectedly

2008-03-18 Thread Colin Wetherbee
Chadwick Horn wrote: It looks to me like psql is managing to start a new connection before the postmaster notices the crash of the prior backend and tells everybody to get out of town. Which is odd, but maybe not too implausible if your kernel is set up to favor interactive processes over ba

Re: [SQL] Create on insert a unique random number

2008-03-18 Thread Erik Jones
On Mar 18, 2008, at 1:40 PM, Campbell, Lance wrote: Thanks for all of your input. It appears that the best way to do this is to create a default random number in the primary id field in the table definition and then return that value after insert. If an exception occurs because of duplicates

Re: [SQL] Create on insert a unique random number

2008-03-18 Thread Vivek Khera
On Mar 18, 2008, at 2:40 PM, Campbell, Lance wrote: Why use a random number as a primary key? Security via obscurity. I build web applications for a living. In most of my applications it is preferable to use a random primary key. Why? Don't expose the actual ID to the end user; only ex

Re: [SQL] Create on insert a unique random number

2008-03-18 Thread Steve Midgley
At 11:58 AM 3/18/2008, [EMAIL PROTECTED] wrote: Date: Tue, 18 Mar 2008 13:40:42 -0500 From: "Campbell, Lance" <[EMAIL PROTECTED]> To: "Vivek Khera" <[EMAIL PROTECTED]>, Subject: Re: Create on insert a unique random number Message-ID: <[EMAIL PROTECTED]> Thanks for all of your input.

Re: [SQL] Create on insert a unique random number

2008-03-18 Thread D'Arcy J.M. Cain
On Tue, 18 Mar 2008 13:40:42 -0500 "Campbell, Lance" <[EMAIL PROTECTED]> wrote: > Why use a random number as a primary key? Security via obscurity. Something with very short shelf life but... > I build web applications for a living. In most of my applications it is > preferable to use a random

Re: [SQL] Create on insert a unique random number

2008-03-18 Thread D'Arcy J.M. Cain
On Tue, 18 Mar 2008 12:23:35 -0700 Steve Midgley <[EMAIL PROTECTED]> wrote: > 1) Create a second field (as someone recommend on this list) that is an > MD5 of your primary key. Use that as your "accessor" index from the web I strongly disagree for three reasons. First, if you are going to gener

[SQL] pg_dump using SQL

2008-03-18 Thread Yusnel Rojas García
Hi everyone Is there any way to do what pg_dump does?, I mean, get the structure of a table in a database (ex: CREATE TABLE ...) thanks in advance.

Re: [SQL] Create on insert a unique random number

2008-03-18 Thread Steve Midgley
At 12:36 PM 3/18/2008, D'Arcy J.M. Cain wrote: On Tue, 18 Mar 2008 12:23:35 -0700 Steve Midgley <[EMAIL PROTECTED]> wrote: > 1) Create a second field (as someone recommend on this list) that is an > MD5 of your primary key. Use that as your "accessor" index from the web I strongly disagree fo

Re: [SQL] pg_dump using SQL

2008-03-18 Thread Phillip Smith
> Is there any way to do what pg_dump does?, I mean, get the structure of a table in a database (ex: CREATE TABLE ...) Turn Query Logging on in postgresql.conf then see what queries are executed by pgAdmin or similar when you run it? THINK BEFORE YOU PRINT - Save paper if you don't really need t

Re: [SQL] pg_dump using SQL

2008-03-18 Thread Tom Lane
"Phillip Smith" <[EMAIL PROTECTED]> writes: >> Is there any way to do what pg_dump does?, I mean, get the structure of a >> table in a database (ex: CREATE TABLE ...) > Turn Query Logging on in postgresql.conf then see what queries are executed > by pgAdmin or similar when you run it? But note th