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?