Thread: pg_dump incorrect sequence value

pg_dump incorrect sequence value

From
"Joshua L. San Juan"
Date:
Hi,

I had dumped data using the command:

pg_dump -U dbowner dbname -a -t table -f table-data.sql

two tables (e.g. table1, table2).

In the first table - the correct sequence was set as can
be seen at the end of the dump file:

....
SELECT pg_catalog.setval ('table1_id_seq', 20, true);

but in the second table - the sequence was incorrect:

...
SELECT pg_catalog.setval ('table2_id_seq', 1, true);

Question:
How do I correct this so that dumping data sets the
correct sequence value?

Using:
Red Hat 8
Linux 2.4.18-14 #1 Wed Sep 4 13:35:50 EDT 2002 i686 GNU/Linux

postgresql-libs-7.3.3-1PGDG
postgresql-tcl-7.3.3-1PGDG
postgresql-server-7.3.3-1PGDG
postgresql-7.3.3-1PGDG
postgresql-libs-7.2.2-1
postgresql-contrib-7.3.3-1PGDG



TIA,

Joshua





Re: pg_dump incorrect sequence value

From
Tom Lane
Date:
"Joshua L. San Juan" <josh.sanjuan@q-linux.com> writes:
> but in the second table - the sequence was incorrect:
> SELECT pg_catalog.setval ('table2_id_seq', 1, true);

It seems fairly hard to believe that what pg_dump emitted was not the
actual state of the sequence object.  Why do you think this is incorrect?

            regards, tom lane