From: | Greg Donald <gdonald(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | PostgreSQL 9.1 pg_dump setval() sets wrong value |
Date: | 2011-12-28 05:19:38 |
Message-ID: | CAO+WgCZuBmK1EW4xE3KirTaUW9Fz4k3aUs_aMhwbd86qS_SzAA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I upgraded to PostgreSQL 9.1. I was using 8.4 previously.
My problem is with the new version of pg_dump. It no longer
(consistently) dumps my sequence values correctly.
For example, I have a table
CREATE TABLE setting (
id integer NOT NULL,
company_id integer NOT NULL,
[...]
);
The max(id) in that table is 61, and my sequence is dumped correctly,
I find this in my backup:
SELECT pg_catalog.setval('setting_id_seq', 61, true);
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);
I know how to fix it, but I'm not sure why it's doing this? Why are
some sequences set wrong while others are fine?
I Google'd and found Tom Lane's post from '06 about how 'sequences are
black boxes', but not much else turned up.
Surely I don't have to maintain a separate sequence fix-up script to
keep with my backups, do I?
Thanks.
--
Greg Donald
From | Date | Subject | |
---|---|---|---|
Next Message | Raghavendra | 2011-12-28 05:27:25 | Re: Show <parameter> in psql does any calculations? |
Previous Message | Tom Lane | 2011-12-28 00:41:54 | Re: Detecting uncommitted changes |