Skip site navigation (1) Skip section navigation (2)

Re: Cannot insert a duplicate key into unique index

From: <kynn(at)panix(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Cannot insert a duplicate key into unique index
Date: 2004-02-19 12:03:25
Message-ID: 200402191203.i1JC3Pq02831@panix3.panix.com (view raw or flat)
Thread:
Lists: pgsql-novice

   Date: Thu, 19 Feb 2004 08:01:04 +0100
   From: daq <daq(at)ugyvitelszolgaltato(dot)hu>

   The setval function updates the last_value field of the sequence table. You don't need the "+ 1".

   select setval('seq-name', (select max(col) from table));

Thank you all for the help.  I'm almost there.

How can I list all the sequences in the database, with their
attributes (such as last_value)?  (I'm having a hard time guessing
'seq-name'; the 'A_id_seq' formula did not work.)

For that matter (going beyond my original question) does PostgreSQL
have anything like a comprehensive "catalog" function that will list
all the tables, their fields, etc. defined in the database?

Thanks!

kj


In response to

Responses

pgsql-novice by date

Next:From: daqDate: 2004-02-19 14:12:09
Subject: Re: Cannot insert a duplicate key into unique index
Previous:From: daqDate: 2004-02-19 07:01:04
Subject: Re: Cannot insert a duplicate key into unique index

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group