From: | Scott Frankel <leknarf(at)pacbell(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | view table pkey values |
Date: | 2009-08-24 16:31:00 |
Message-ID: | 714B692C-6F0B-4EE6-8809-6818ABF1ED38@pacbell.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello,
Is it possible to select or otherwise view a table's primary key values?
I'm troubleshooting the following error:
ERROR: duplicate key value violates unique constraint "foo_pkey"
The insert that yields the error seems innocuous enough:
INSERT INTO foo (color_id, ordinal, person_id) VALUES (1, 1019, 2);
It seems as if there's a sequence (foo_pkey) that's got some weird
values in it. The table itself looks like this:
CREATE TABLE foo (
foo_id SERIAL PRIMARY KEY,
color_id INTEGER NOT NULL REFERENCES color(color_id) ON DELETE NO
ACTION,
ordinal INTEGER DEFAULT NULL,
person_id INTEGER NOT NULL REFERENCES person(person_id) ON DELETE
SET NULL ON UPDATE CASCADE,
created timestamp DEFAULT CURRENT_TIMESTAMP);
Thanks in advance,
Scott
From | Date | Subject | |
---|---|---|---|
Next Message | Raymond O'Donnell | 2009-08-24 16:43:30 | Re: view table pkey values |
Previous Message | Denis BUCHER | 2009-08-24 16:23:22 | Re: Strange "missing tables" problem |