On Wed, 10 Oct 2001, Ralf Miller wrote:
> First question:
> The example shows that the column number of type serial is incremented
> as if the preceding insert-statement was successfull, even if it was
> Are the values for the column number of type serial inserted into the
> sequence before the attempt to insert into the table and are not deleted
> if the
> latter fails ?
> But maybe this behaviour was intended to log succcessless attempts to
> insert into the table.
This is intentional. If the sequence number were to roll back, then a
later transaction trying to get the next sequence number would have
to wait to determine if you've rolled back before getting the number.
Sequences are defined to try to give unique, increasing numbers, not
actually sequential ones.
> Second question:
> The SEQUENCE corresponding to a column of type serial is not beeing
> automatically when the table containing the serial-column is droped.
> Does it make sense to store a sequence without a corresponding table ?
The serial sequence probably should go away, but there isn't anything
that would stop you from referencing the sequence somewhere else using
nextval or currval.
In response to
pgsql-bugs by date
|Next:||From: pgsql-bugs||Date: 2001-10-15 16:22:23|
|Subject: Bug #482: psql (7.1.3) doesn't like sysid=0|
|Previous:||From: Bruce Momjian||Date: 2001-10-15 15:35:57|
|Subject: Re: probably a bug of data-type serial|