Re: [GENERAL] serial column

2006-09-27 Thread Brandon Aiken
Title: RE: [GENERAL] serial column Yes, but if I tear down the house at 245 Main St, we don't renumber 247 Main St and on down the line, do we? The problem here is that even if you get the sequencing to work, your table is dangerously unstable.  If you have 700 rows and you delete row

Re: [GENERAL] serial column

2006-09-26 Thread Brandon Aiken
mailto:[EMAIL PROTECTED] Sent: Monday, September 25, 2006 12:00 PM To: Brandon Aiken; pgsql-general@postgresql.org Subject: Re: [GENERAL] serial column Actually, I am not trying to "force keys" nor, I don't beleive, am I trying to force an hierarchal structure within the database.

Re: [GENERAL] serial column

2006-09-25 Thread Jeff Davis
On Mon, 2006-09-25 at 00:19 +0200, Gevik Babakhani wrote: > On Sun, 2006-09-24 at 14:49 -0700, Bob Pawley wrote: > > It's the behavior I expect - but the gaps aren't acceptable. > > > > Bob > > Then using the SERIAL or SEQUENCE won't do you any good. > > A possible solution for this would be to

Re: [GENERAL] serial column

2006-09-25 Thread Bob Pawley
e lowest serial ID number. ) Thanks for your comments - everything helps at my stage. Bob Pawley - Original Message - From: "Brandon Aiken" <[EMAIL PROTECTED]> To: Sent: Monday, September 25, 2006 7:47 AM Subject: Re: [GENERAL] serial column I would tend to

Re: [GENERAL] serial column

2006-09-25 Thread Brandon Aiken
do relationships it doesn't know about, so you technically violate first normal form by having a multi-valued field (it identifies uniqueness and order). -- Brandon Aiken CS/IT Systems Engineer -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of To

Re: [GENERAL] serial column

2006-09-24 Thread Adrian Klaver
a gap. > > Perhaps a manually built table is the answer?? > > Bob > > > - Original Message - > From: "Tom Lane" <[EMAIL PROTECTED]> > To: "Bob Pawley" <[EMAIL PROTECTED]> > Cc: "Ragnar" <[EMAIL PROTECTED]>; "

Re: [GENERAL] serial column

2006-09-24 Thread Bob Pawley
uot; Sent: Sunday, September 24, 2006 4:30 PM Subject: Re: [GENERAL] serial column Bob Pawley <[EMAIL PROTECTED]> writes: I am using the numbers to identify devices. If a device is deleted or replaced with another type of device I want the numbering to still be sequential. It sounds to me l

Re: [GENERAL] serial column

2006-09-24 Thread Bob Pawley
D]> To: Cc: "Bob Pawley" <[EMAIL PROTECTED]> Sent: Sunday, September 24, 2006 6:11 PM Subject: Re: [GENERAL] serial column On Sunday 24 September 2006 02:29 pm, Bob Pawley wrote: Choice a. I am using the numbers to identify devices. If a device is deleted or replaced with anothe

Re: [GENERAL] serial column

2006-09-24 Thread Adrian Klaver
On Sunday 24 September 2006 02:29 pm, Bob Pawley wrote: > Choice a. > > I am using the numbers to identify devices. > > If a device is deleted or replaced with another type of device I want the > numbering to still be sequential. > > Bob > Do you have some other way of tracking a device? I am just

Re: [GENERAL] serial column

2006-09-24 Thread Bob Pawley
Thanks I'll give that a try. Bob - Original Message - From: "Gevik Babakhani" <[EMAIL PROTECTED]> To: "Bob Pawley" <[EMAIL PROTECTED]> Cc: "Postgresql" Sent: Sunday, September 24, 2006 4:13 PM Subject: Re: [GENERAL] serial column On S

Re: [GENERAL] serial column

2006-09-24 Thread Tom Lane
Bob Pawley <[EMAIL PROTECTED]> writes: > I am using the numbers to identify devices. > If a device is deleted or replaced with another type of device I want the > numbering to still be sequential. It sounds to me like you oughtn't be storing these numbers in the database at all. You just want to

Re: [GENERAL] serial column

2006-09-24 Thread Gevik Babakhani
On Sun, 2006-09-24 at 15:29 -0700, Bob Pawley wrote: > "A possible solution for this would be to regenerate the entire column's > values every time a record gets deleted starting form 1. but then again > this would be very slow if you have a very large table" > > I don't anticipate the table to be

Re: [GENERAL] serial column

2006-09-24 Thread Bob Pawley
ot; Sent: Sunday, September 24, 2006 3:19 PM Subject: Re: [GENERAL] serial column On Sun, 2006-09-24 at 14:49 -0700, Bob Pawley wrote: It's the behavior I expect - but the gaps aren't acceptable. Bob Then using the SERIAL or SEQUENCE won't do you any good. A possible solut

Re: [GENERAL] serial column

2006-09-24 Thread Bob Pawley
Do you have a for instance?? Bob - Original Message - From: "Ragnar" <[EMAIL PROTECTED]> To: "Bob Pawley" <[EMAIL PROTECTED]> Cc: "Postgresql" Sent: Sunday, September 24, 2006 3:10 PM Subject: Re: [GENERAL] serial column On sun, 2006-09-24

Re: [GENERAL] serial column

2006-09-24 Thread Gevik Babakhani
On Sun, 2006-09-24 at 14:49 -0700, Bob Pawley wrote: > It's the behavior I expect - but the gaps aren't acceptable. > > Bob Then using the SERIAL or SEQUENCE won't do you any good. A possible solution for this would be to regenerate the entire column's values every time a record gets deleted sta

Re: [GENERAL] serial column

2006-09-24 Thread Ragnar
On sun, 2006-09-24 at 14:29 -0700, Bob Pawley wrote: > Choice a. > > I am using the numbers to identify devices. > > If a device is deleted or replaced with another type of device I want the > numbering to still be sequential. have you tried to implement ths using triggers? gnari --

Re: [GENERAL] serial column

2006-09-24 Thread Bob Pawley
It's the behavior I expect - but the gaps aren't acceptable. Bob - Original Message - From: "Gevik Babakhani" <[EMAIL PROTECTED]> To: "Bob Pawley" <[EMAIL PROTECTED]> Cc: "Postgresql" Sent: Sunday, September 24, 2006 2:42 PM S

Re: [GENERAL] serial column

2006-09-24 Thread Gevik Babakhani
esolve. > > Bob > > - Original Message - > From: "Gevik Babakhani" <[EMAIL PROTECTED]> > To: "Bob Pawley" <[EMAIL PROTECTED]> > Cc: "Postgresql" > Sent: Sunday, September 24, 2006 2:00 PM > Subject: Re: [GENERAL] ser

Re: [GENERAL] serial column

2006-09-24 Thread Bob Pawley
CTED]> Cc: "Postgresql" Sent: Sunday, September 24, 2006 2:24 PM Subject: Re: [GENERAL] serial column On sun, 2006-09-24 at 13:50 -0700, Bob Pawley wrote: I need to develop a serial column that always starts at 1 and is sequential even after deletes. what exactly do you mean?

Re: [GENERAL] serial column

2006-09-24 Thread Ragnar
On sun, 2006-09-24 at 13:50 -0700, Bob Pawley wrote: > I need to develop a serial column that always starts at 1 and is > sequential even after deletes. what exactly do you mean? say you have rows where your columns has values 1,2,3 and 4. you now delete the row where the value is 2. what do yo

Re: [GENERAL] serial column

2006-09-24 Thread Bob Pawley
akhani" <[EMAIL PROTECTED]> To: "Bob Pawley" <[EMAIL PROTECTED]> Cc: "Postgresql" Sent: Sunday, September 24, 2006 2:00 PM Subject: Re: [GENERAL] serial column On Sun, 2006-09-24 at 13:50 -0700, Bob Pawley wrote: I need to develop a serial column that always sta

Re: [GENERAL] serial column

2006-09-24 Thread Gevik Babakhani
On Sun, 2006-09-24 at 13:50 -0700, Bob Pawley wrote: > I need to develop a serial column that always starts at 1 and is > sequential even after deletes. > > Any ideas??? > Did you try the: create table tbl ( id SERIAL ); or even with primary key... create table tbl ( id SERI

[GENERAL] serial column

2006-09-24 Thread Bob Pawley
I need to develop a serial column that always starts at 1 and is sequential even after deletes.   Any ideas???   Bob    

Re: [GENERAL] Serial column has suddenly stopped working

2004-12-16 Thread Malcolm Warren
The answer is 3. Mistake of mine. I put in a field of the same name to display it, and it was also sending 0 with the statement. Thank you for helping me get to the bottom of it. Malcolm Warren Richard Huxton wrote: Malcolm Warren wrote: Thank you for your reply. Yes, I get the next number and th

Re: [GENERAL] Serial column has suddenly stopped working

2004-12-16 Thread Richard Huxton
Malcolm Warren wrote: I have been using a serial column in my most important postgres table for a couple of years. But today it has suddenly started assigning zero instead of the next number, which clearly is causing chaos. I have restarted Postgres, but it has not solved the problem. I cannot

[GENERAL] Serial column has suddenly stopped working

2004-12-16 Thread Malcolm Warren
I have been using a serial column in my most important postgres table for a couple of years. But today it has suddenly started assigning zero instead of the next number, which clearly is causing chaos. I have restarted Postgres, but it has not solved the problem. I cannot re-assign the serial n