Re: [GENERAL] view table pkey values

2009-08-25 Thread Scott Frankel
Thanks for the thorough explanation and link to more docs. Very much appreciated! Scott On Aug 24, 2009, at 11:03 AM, Raymond O'Donnell wrote: On 24/08/2009 18:37, Scott Frankel wrote: If I understand how tables are managed internally, there are 2 sequences: my explicit foo_id and the

Re: [GENERAL] view table pkey values

2009-08-24 Thread Raymond O'Donnell
On 24/08/2009 18:37, Scott Frankel wrote: > If I understand how tables are managed internally, there are 2 > sequences: my explicit foo_id and the internal sequence > foo_foo_id_seq: > > public | foo_foo_id_seq | sequence | pguser | > > It's this internal sequence that must be involved in the c

Re: [GENERAL] view table pkey values

2009-08-24 Thread Scott Frankel
Got it! Yes, this started happening after loading from a pg_dump. Thanks for the explanation! Scott On Aug 24, 2009, at 10:52 AM, Tom Lane wrote: Scott Frankel writes: Is there a command that lists the values for the internal, foo_foo_id_seq, sequence? select * from foo_foo_id_seq;

Re: [GENERAL] view table pkey values

2009-08-24 Thread Tom Lane
Scott Frankel writes: > Is there a command that lists the values for the internal, > foo_foo_id_seq, sequence? select * from foo_foo_id_seq; The usual way to get into this sort of trouble is to load a bunch of data into the table while explicitly specifying ID values. It will take the data (a

Re: [GENERAL] view table pkey values

2009-08-24 Thread Scott Frankel
Hi Ray, On Aug 24, 2009, at 9:48 AM, Raymond O'Donnell wrote: On 24/08/2009 17:31, Scott Frankel wrote: 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

Re: [GENERAL] view table pkey values

2009-08-24 Thread Raymond O'Donnell
On 24/08/2009 17:31, Scott Frankel wrote: > 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

Re: [GENERAL] view table pkey values

2009-08-24 Thread Raymond O'Donnell
On 24/08/2009 17:31, Scott Frankel wrote: > Is it possible to select or otherwise view a table's primary key values? [snip] > CREATE TABLE foo ( > foo_idSERIALPRIMARY KEY, select foo_id from foo; ? or am I missing something? Ray. --

[GENERAL] view table pkey values

2009-08-24 Thread Scott Frankel
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, ordi