Re: [HACKERS] SERIAL data type - Mailing list pgsql-hackers

From Thomas G. Lockhart
Subject Re: [HACKERS] SERIAL data type
Date
Msg-id 35FA1025.EF2C0AC1@alumni.caltech.edu
Whole thread Raw
In response to Re: [HACKERS] SERIAL data type  ("Billy G. Allie" <Bill.Allie@mug.org>)
List pgsql-hackers
> o dropping a table including a serial data type does not drop the
>   sequence corresponding to the table. This prevents re-creating the
>   table. Do we have to remove the sequence by hand?

Yes, at the moment. I don't have specific plans to change/fix things for
v6.4, but might be possible. It would be OK if someone else wanted to
pick up the coding and carry it forward...

> 1.  Explicit insertion into a serial column be dis-allowed.
> 2.  If explicit insertion is allowed, then the sequence need to be set
>     so the next implicit insertsion result in the last explicit
>     insertion value + 1 being used
> Of these two options, I prefer #1.

I wonder if we can use the rewrite rules system to implement #1?

> Also, should we be able to specify a starting value for the sequence
> when the table is created?  For example
>   create table t (c text, i serial(1000));
> to set the starting value of the sequence to 1000.

There was some discussion of this and at least one person thought it was
an ugly feature (this is available on Sybase, right?). So I didn't even
try to implement it.

                       - Tom

pgsql-hackers by date:

Previous
From: "Thomas G. Lockhart"
Date:
Subject: Re: [HACKERS] Serial Data Type
Next
From: Keith Parks
Date:
Subject: Exception in select IN with index