Re: insert bug

Поиск
Список
Период
Сортировка
От Andrew Sullivan
Тема Re: insert bug
Дата
Msg-id 20030715141150.GE27367@libertyrms.info
обсуждение исходный текст
Ответ на insert bug  (Scott Cain <cain@cshl.org>)
Список pgsql-general
On Tue, Jul 15, 2003 at 10:01:01AM -0400, Scott Cain wrote:

>not null default nextval('public.fdata _fid_seq'::text)
                          ^^^^^^^^^^^^^^^^^^^^^

Someone must have inserted some data beyond the range of that
sequence into your primary key.  When you do the nextval() on the
sequence, you get the next value, and it may clash with something
already inserted in fid.  A way to check is to select everything from
the sequence, and select the maximum value from your primary key; if
the latter is higher than the former, that's your problem.

You can use setval() to fix this.

It's probably useful to note that inserting something into a
serial field does not automatically increment the sequence
itself.  Indeed, the datatype "serial" is just a handy shorthand: it
creates the sequence for you, and sets the column to default
nextval() on the sequence.

A

--
----
Andrew Sullivan                         204-4141 Yonge Street
Liberty RMS                           Toronto, Ontario Canada
<andrew@libertyrms.info>                              M2P 2A8
                                         +1 416 646 3304 x110


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: plperl language_handler Problems
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Large Objects in serializable transaction question