From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | Ralf Miller <rm(at)topnet(dot)de> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: probably a bug of data-type serial |
Date: | 2001-10-15 15:45:37 |
Message-ID: | Pine.BSF.4.21.0110150841360.11740-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
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
> not.
> Are the values for the column number of type serial inserted into the
> corresponding
> 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
> droped
> 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.
From | Date | Subject | |
---|---|---|---|
Next Message | pgsql-bugs | 2001-10-15 16:22:23 | Bug #482: psql (7.1.3) doesn't like sysid=0 |
Previous Message | Bruce Momjian | 2001-10-15 15:35:57 | Re: probably a bug of data-type serial |