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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-novice by date

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