Re: probably a bug of data-type serial

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: probably a bug of data-type serial
Дата
Msg-id 200110151535.f9FFZv627397@candle.pha.pa.us
обсуждение исходный текст
Ответ на probably a bug of data-type serial  (Ralf Miller <rm@topnet.de>)
Список 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@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: ecpg - GRANT bug
Следующее
От: pgsql-bugs@postgresql.org
Дата:
Сообщение: Bug #500: Cannot create View and Problems With the UNION clause