Re: serial column

From: Bob Pawley <rjpawley(at)shaw(dot)ca>
To: Gevik Babakhani <pgdev(at)xs4all(dot)nl>
Cc: Postgresql <pgsql-general(at)postgresql(dot)org>
Subject: Re: serial column
Date: 2006-09-24 21:49:37
Message-ID: 006e01c6e023$54a674b0$8e904618@owner
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

It's the behavior I expect - but the gaps aren't acceptable.

Bob

----- Original Message -----
From: "Gevik Babakhani" <pgdev(at)xs4all(dot)nl>
To: "Bob Pawley" <rjpawley(at)shaw(dot)ca>
Cc: "Postgresql" <pgsql-general(at)postgresql(dot)org>
Sent: Sunday, September 24, 2006 2:42 PM
Subject: Re: [GENERAL] serial column

> The SERIAL is always sequential. SERIAL internally creates a SEQUENCE
> and *binds* it to your table. even if you delete a record and insert a
> new one , the sequence will continue to increment. however there will be
> gaps between the values.
>
> Isn't this the behavior you expect?
>
>
> On Sun, 2006-09-24 at 14:19 -0700, Bob Pawley wrote:
>> Yes
>>
>> But the only way of insuring that the serial starts at 1 and is
>> sequential
>> is to recreate the table.
>>
>> I've tried creating and dropping the table but this generates other
>> issues
>> which I haven't been able to resolve.
>>
>> Bob
>>
>> ----- Original Message -----
>> From: "Gevik Babakhani" <pgdev(at)xs4all(dot)nl>
>> To: "Bob Pawley" <rjpawley(at)shaw(dot)ca>
>> Cc: "Postgresql" <pgsql-general(at)postgresql(dot)org>
>> 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 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 SERIAL primary key
>> > );
>> >
>> >
>> > --
>> > Regards,
>> > Gevik Babakhani
>> >
>> >
>> >
>> >
>> > ---------------------------(end of
>> > broadcast)---------------------------
>> > TIP 3: Have you checked our extensive FAQ?
>> >
>> > http://www.postgresql.org/docs/faq
>> >
>>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ragnar 2006-09-24 22:10:41 Re: serial column
Previous Message Gevik Babakhani 2006-09-24 21:42:20 Re: serial column