Thread: Identified a problem in pg_dump with serial data type and mixed case

Identified a problem in pg_dump with serial data type and mixed case

From
Mario Weilguni
Date:
-----BEGIN PGP SIGNED MESSAGE-----

- -----BEGIN PGP SIGNED MESSAGE-----

I've found a problem in pg_dump which results in unreliable dumps under the
following conditions:
* The serial datatype is used
* Either the table or a column name is mixed case

Example:
CREATE TABLE "Test1" ( id serial, dummy int
);

pg_dump thisdb
CREATE SEQUENCE "Test1_id_seq" start 1 increment 1 maxvalue 2147483647
minvalue 1  cache 1 ;
CREATE TABLE "Test1" (       "id" int4 DEFAULT nextval('Test1_id_seq'::text) NOT NULL,       "dummy" int4
);
COPY "Test1" FROM stdin;
\.
CREATE UNIQUE INDEX "Test1_id_key" on "Test1" using btree ( "id" "int4_ops"
);

The error is in the line       "id" int4 DEFAULT nextval('Test1_id_seq'::text) NOT NULL,
which should read       "id" int4 DEFAULT nextval('"Test1_id_seq"'::text) NOT NULL,

I've tried to fix the error in pg_dump.c, but noticed that I would have to go
deeper, because not pg_dump is the problem but somewhere else. So I would be
gratefull if somebody can either help me where to start bug hunting or fix
this bug, which should be really easy (put quotes around the sequence name).

When replying, please send me a CC, my subscription to this list is not yet
processed. Thanks.

Mario Weilguni
- -----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv

iQCVAwUBOZOWhQotfkegMgnVAQFVGAP+Monp4VVCG350XUaMfhrP0EhODIWpTFJO
8udkYjJZdhLx7csoVgmi/fBQVVUikJEXuAV82e0xpJ9LGOcfRomnHa9KZnaX7q0a
nmKMJ09Ve88Seszf0yGIhr9DabXkYfKhEQ6MjNhagyeF9ajsKSeBJxfnR1UocEHp
c328CLLzMBI=
=UiDy
- -----END PGP SIGNATURE-----

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv

iQCVAwUBOZOWngotfkegMgnVAQH3JQQAn2K70HIhSWhwVlfyUVM+loS1UYCo372Z
zzIimzmhs66YNPD/LGY7jtbCZuF5h+RvXS28kkeX01GZn/EGv3tSCJE1JSyj1STC
9vfpqJjAUbsBtB1e9WPsyo2yjrUPhUfRwL5HiI7xymC3hHOPM8XDlUUceHUmbrew
EDddtaGL7xc=
=aD4u
-----END PGP SIGNATURE-----


Re: Identified a problem in pg_dump with serial data type and mixed case

From
Tom Lane
Date:
Mario Weilguni <mw@sime.com> writes:
> I've found a problem in pg_dump which results in unreliable dumps under the
> following conditions:

What version are you using?  This appears to work correctly in current
sources --- I get

CREATE TABLE "Test1" (       "id" int4 DEFAULT nextval('"Test1_id_seq"'::text) NOT NULL,       "dummy" int4
);

Not sure offhand how long ago it was fixed, though.
        regards, tom lane