Re: PostgreSQL 9.1 pg_dump setval() sets wrong value - Mailing list pgsql-general

From Scott Marlowe
Subject Re: PostgreSQL 9.1 pg_dump setval() sets wrong value
Date
Msg-id CAOR=d=2JZpy0RAeFz=Fjf6p4Qui7MdQvpOzRYywOQ1KDr91emg@mail.gmail.com
Whole thread Raw
In response to PostgreSQL 9.1 pg_dump setval() sets wrong value  (Greg Donald <gdonald@gmail.com>)
Responses Re: PostgreSQL 9.1 pg_dump setval() sets wrong value
List pgsql-general
On Tue, Dec 27, 2011 at 10:19 PM, Greg Donald <gdonald@gmail.com> wrote:
> But then I have another table:
>
> CREATE TABLE company (
>    id integer NOT NULL,
>    name character varying(64) NOT NULL,
>    [...]
> );
>
> The max(id) in that table is 33, but my sequence is NOT dumped correctly:
>
> SELECT pg_catalog.setval('company_id_seq', 1, false);

The max value of a sequence is NOT determined by the max value in the
table, but by what it was set to by being retrieved last.  Are you
sure that the sequence is being used to insert those values into the
table?

pgsql-general by date:

Previous
From: Thangalin
Date:
Subject: Create XML elements from rows
Next
From: Raghavendra
Date:
Subject: Re: Create XML elements from rows