Thread: pg_dump output
Due to the urgency, I resend my mail about pg_dump output: In 7.0.2 I got INSERT INTO foo (field) VALUES ('Hello,\012world!'); In 7.1beta4 I get INSERT INTO foo (field) VALUES ('Hello, world!'); I am using these switches: -a, -c, -n, -d or -D. Is it possible to add a switch to pg_dump to make it possible getting the old output. Where can I balance it in the source if I'd like to change the behaviour? TIA, Zoltan -- Kov\'acs, Zolt\'an kovacsz@pc10.radnoti-szeged.sulinet.hu http://www.math.u-szeged.hu/~kovzol ftp://pc10.radnoti-szeged.sulinet.hu/home/kovacsz
Kovacs Zoltan writes: > In 7.0.2 I got > INSERT INTO foo (field) VALUES ('Hello,\012world!'); > In 7.1beta4 I get > INSERT INTO foo (field) VALUES ('Hello, > world!'); > Is it possible to add a switch to pg_dump to make it possible getting the > old output. Where can I balance it in the source if I'd like to change the > behaviour? I kind of agree that the old output should be preferred. Otherwise we might be entering a whole new world of CR/LF sort of problems. Btw., if I select the default COPY output, pg_dump seems to drop non-printable characters like '\001'. -- Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
On Mon, 12 Feb 2001, Peter Eisentraut wrote: > Kovacs Zoltan writes: > > > In 7.0.2 I got > > INSERT INTO foo (field) VALUES ('Hello,\012world!'); > > > In 7.1beta4 I get > > INSERT INTO foo (field) VALUES ('Hello, > > world!'); > > > Is it possible to add a switch to pg_dump to make it possible getting the > > old output. Where can I balance it in the source if I'd like to change the > > behaviour? > > I kind of agree that the old output should be preferred. Otherwise we > might be entering a whole new world of CR/LF sort of problems. > > Btw., if I select the default COPY output, pg_dump seems to drop > non-printable characters like '\001'. OK, I found it. In pg_dump.c, function formatStringLiteral(), the line containing '\n' and '\t' should be deleted (or check whether a switch is on or not). Zoltan -- Kov\'acs, Zolt\'an kovacsz@pc10.radnoti-szeged.sulinet.hu http://www.math.u-szeged.hu/~kovzol ftp://pc10.radnoti-szeged.sulinet.hu/home/kovacsz
Peter Eisentraut <peter_e@gmx.net> writes: > Btw., if I select the default COPY output, pg_dump seems to drop > non-printable characters like '\001'. You sure? They're there in my output. COPY doesn't turn them into escape sequences, if that's what you were expecting. regards, tom lane
Tom Lane writes: > Peter Eisentraut <peter_e@gmx.net> writes: > > Btw., if I select the default COPY output, pg_dump seems to drop > > non-printable characters like '\001'. > > You sure? They're there in my output. COPY doesn't turn them into > escape sequences, if that's what you were expecting. If I do INSERT INTO test VALUES ('foo\001bar'); then pg_dump writes COPY "test" FROM stdin; foobar \. This is incorrect. -- Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
Tom Lane writes: > What are you using to inspect the file? Ugh... :-/ -- Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
Peter Eisentraut <peter_e@gmx.net> writes: > Tom Lane writes: >> Peter Eisentraut <peter_e@gmx.net> writes: > Btw., if I select the default COPY output, pg_dump seems to drop > non-printable characters like '\001'. >> >> You sure? They're there in my output. COPY doesn't turn them into >> escape sequences, if that's what you were expecting. > If I do > INSERT INTO test VALUES ('foo\001bar'); > then pg_dump writes > COPY "test" FROM stdin; > foobar > \. What I get is 'foo^Abar'. What are you using to inspect the file? regards, tom lane
By the way, I get each sequence twice in pg_dump output... In psql: CREATE TABLE x (y SERIAL); Then running pg_dump with switches -xacnOD, I get: -- -- Selected TOC Entries: -- DROP SEQUENCE x_y_seq; DROP SEQUENCE x_y_seq; -- -- TOC Entry ID 1 (OID 2625010) -- -- Name: x_y_seq Type: SEQUENCE Owner: postgres -- CREATE SEQUENCE x_y_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ; -- -- TOC Entry ID 3 (OID 2625010) -- -- Name: x_y_seq Type: SEQUENCE Owner: postgres -- CREATE SEQUENCE x_y_seq start 1 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ; -- -- Data for TOC Entry ID 5 (OID 2625029) TABLE DATA x -- \connect - postgres -- Disable triggers UPDATE "pg_class" SET "reltriggers" = 0 WHERE "relname" ~* 'x'; -- Enable triggers CREATE TEMP TABLE "tr" ("tmp_relname" name, "tmp_reltriggers" smallint); INSERT INTO "tr" SELECT C."relname", count(T."oid") FROM "pg_class" C, "pg_trigger" T WHERE C."oid" = T."tgrelid" AND C."relname" ~* 'x' GROUP BY 1; UPDATE "pg_class" SET "reltriggers" = TMP."tmp_reltriggers" FROM "tr" TMP WHERE "pg_class"."relname" = TMP."tmp_relname"; DROP TABLE "tr"; COMMIT TRANSACTION; -- -- TOC Entry ID 2 (OID 2625010) -- -- Name: x_y_seq Type: SEQUENCE SET Owner: -- SELECT setval ('x_y_seq', 1, 'f'); -- -- TOC Entry ID 4 (OID 2625010) -- -- Name: x_y_seq Type: SEQUENCE SET Owner: -- SELECT setval ('x_y_seq', 1, 'f'); ------------------------------------------------------------------------- Is this correct? Zoltan -- Kov\'acs, Zolt\'an kovacsz@pc10.radnoti-szeged.sulinet.hu http://www.math.u-szeged.hu/~kovzol ftp://pc10.radnoti-szeged.sulinet.hu/home/kovacsz
At 22:25 12/02/01 +0100, Kovacs Zoltan wrote: >By the way, I get each sequence twice in pg_dump output... In psql: > >CREATE TABLE x (y SERIAL); > >Then running pg_dump with switches -xacnOD, I get: > >-- >-- Selected TOC Entries: >-- >DROP SEQUENCE x_y_seq; >DROP SEQUENCE x_y_seq; Doesn't happen here - does anybody else see this? Can you confirm it happens on a freshly created database? If so, can you try: pg_dump blah -Fc -v > z.bck and send both the output and z.bck direct to me? ---------------------------------------------------------------- Philip Warner | __---_____ Albatross Consulting Pty. Ltd. |----/ - \ (A.B.N. 75 008 659 498) | /(@) ______---_ Tel: (+61) 0500 83 82 81 | _________ \ Fax: (+61) 0500 83 82 82 | ___________ | Http://www.rhyme.com.au | / \| | --________-- PGP key available upon request, | / and from pgp5.ai.mit.edu:11371 |/
At 18:49 12/02/01 +0100, Kovacs Zoltan wrote: >In 7.0.2 I got > >INSERT INTO foo (field) VALUES ('Hello,\012world!'); > >In 7.1beta4 I get > >INSERT INTO foo (field) VALUES ('Hello, >world!'); > I have modified formatLiteralString to accept an arg that tells it how to handle LF & TAB. Now, it will encode *everything* except in comments and procedure bodies. ---------------------------------------------------------------- Philip Warner | __---_____ Albatross Consulting Pty. Ltd. |----/ - \ (A.B.N. 75 008 659 498) | /(@) ______---_ Tel: (+61) 0500 83 82 81 | _________ \ Fax: (+61) 0500 83 82 82 | ___________ | Http://www.rhyme.com.au | / \| | --________-- PGP key available upon request, | / and from pgp5.ai.mit.edu:11371 |/
> I have modified formatLiteralString to accept an arg that tells it how to > handle LF & TAB. Now, it will encode *everything* except in comments and > procedure bodies. Thanks, I checked it. So if I want my own output, I must set CONV_ALL=1, right? Zoltan -- Kov\'acs, Zolt\'an kovacsz@pc10.radnoti-szeged.sulinet.hu http://www.math.u-szeged.hu/~kovzol ftp://pc10.radnoti-szeged.sulinet.hu/home/kovacsz
At 13:35 13/02/01 +0100, Kovacs Zoltan wrote: >> I have modified formatLiteralString to accept an arg that tells it how to >> handle LF & TAB. Now, it will encode *everything* except in comments and >> procedure bodies. >Thanks, I checked it. So if I want my own output, I must set CONV_ALL=1, >right? No. pg_dump now does what you want by default. If not, let me know... ---------------------------------------------------------------- Philip Warner | __---_____ Albatross Consulting Pty. Ltd. |----/ - \ (A.B.N. 75 008 659 498) | /(@) ______---_ Tel: (+61) 0500 83 82 81 | _________ \ Fax: (+61) 0500 83 82 82 | ___________ | Http://www.rhyme.com.au | / \| | --________-- PGP key available upon request, | / and from pgp5.ai.mit.edu:11371 |/
> >Thanks, I checked it. So if I want my own output, I must set CONV_ALL=1, > >right? > > No. pg_dump now does what you want by default. If not, let me know... OK, thanks, this behaviour is excellent for me... :-) -- Kov\'acs, Zolt\'an kovacsz@pc10.radnoti-szeged.sulinet.hu http://www.math.u-szeged.hu/~kovzol ftp://pc10.radnoti-szeged.sulinet.hu/home/kovacsz