Re: probably a bug of data-type serial

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: probably a bug of data-type serial
Дата
Msg-id Pine.BSF.4.21.0110150841360.11740-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на probably a bug of data-type serial  (Ralf Miller <rm@topnet.de>)
Список 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.

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "Lou Picciano"
Дата:
Сообщение: initdb failed: mkdir cannot create directory - No space left on device
Следующее
От: pgsql-bugs@postgresql.org
Дата:
Сообщение: Bug #482: psql (7.1.3) doesn't like sysid=0