Re: PostgreSQL 9.1 pg_dump setval() sets wrong value

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Greg Donald <gdonald(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PostgreSQL 9.1 pg_dump setval() sets wrong value
Date: 2011-12-28 08:15:17
Message-ID: CAOR=d=2JZpy0RAeFz=Fjf6p4Qui7MdQvpOzRYywOQ1KDr91emg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Dec 27, 2011 at 10:19 PM, Greg Donald <gdonald(at)gmail(dot)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?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Raghavendra 2011-12-28 08:15:48 Re: Create XML elements from rows
Previous Message Thangalin 2011-12-28 08:11:28 Create XML elements from rows