Re: probably a bug of data-type serial

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
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:35:57
Message-ID: 200110151535.f9FFZv627397@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> 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.

For performance reasons, failed INSERT's stull use a sequence number.
That way, multiple users can use the sequence without waiting to see if
the transactions commit. This is intended.

> 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 ?

For SERIAL, it should drop the sequence but currently doesn't. As for
using sequences, you can use a sequence for multiple tables so automatic
dropping is probalby not what we want, _except_ for SERIAL.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Stephan Szabo 2001-10-15 15:45:37 Re: probably a bug of data-type serial
Previous Message Lee Kindness 2001-10-15 14:32:27 Re: ecpg - GRANT bug