PostgreSQL 9.1 pg_dump setval() sets wrong value
От | Greg Donald |
---|---|
Тема | PostgreSQL 9.1 pg_dump setval() sets wrong value |
Дата | |
Msg-id | CAO+WgCZuBmK1EW4xE3KirTaUW9Fz4k3aUs_aMhwbd86qS_SzAA@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: PostgreSQL 9.1 pg_dump setval() sets wrong value
|
Список | 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
В списке pgsql-general по дате отправления: