Re: Unique constraint violation on serial column

Поиск
Список
Период
Сортировка
От Bill Chandler
Тема Re: Unique constraint violation on serial column
Дата
Msg-id 20050412162154.70499.qmail@web51402.mail.yahoo.com
обсуждение исходный текст
Ответ на Unique constraint violation on serial column  (Bill Chandler <billybobc1210@yahoo.com>)
Список pgsql-general
All,

In the pg_dump output is the command:

COPY event_tbl (d1, ..., evt_id) FROM stdin;

followed by all the data for the table.  There are
23040 rows.  The last value for evt_id is 23040.  So
far so good.  Then the last statement in the pg_dump
output is:

SELECT pg_catalog.setval('event_tbl_evt_id_seq',
21232, true);

I'm guessing this is my culprit.  But this dump is
from the client site.  Short of somebody mucking with
the sequence manually, is there any way that the
sequence number could get changed?

As I've said, our insert commands are very simple and
we do not specify 'evt_id' values directly.  Does
anybody have any ideas about how this could have
gotten out of sync?

thanks,

Bill

--- Alvaro Herrera <alvherre@dcc.uchile.cl> wrote:
> On Tue, Apr 12, 2005 at 08:48:15AM -0700, Bill
> Chandler wrote:
>
> > How does one find out the current sequence value?
> Is
> > there a way to change it?
>
> Using the function setval() you can change it.
> SELECT * from
> sequencename to find out.
>
> --
> Alvaro Herrera (<alvherre[@]dcc.uchile.cl>)
> "Si quieres ser creativo, aprende el arte de perder
> el tiempo"
>



__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/

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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Unique constraint violation on serial column
Следующее
От: fritz-bayer@web.de (Fritz Bayer)
Дата:
Сообщение: Re: Encoding Issue with UNICODE