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


Mon, 12 Feb 2001 18:49:00 +0100 (CET)
Kovacs Zoltan <kovacsz@pc10.radnoti-szeged.sulinet.hu>
pg_dump output
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/


Mon, 12 Feb 2001 19:24:33 +0100 (CET)
Peter Eisentraut <peter_e@gmx.net>
Re: pg_dump output
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


Mon, 12 Feb 2001 20:10:09 +0100 (CET)
Kovacs Zoltan <kovacsz@pc10.radnoti-szeged.sulinet.hu>
Re: pg_dump output
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

Mon, 12 Feb 2001 15:13:37 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: pg_dump output 
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

Mon, 12 Feb 2001 15:53:37 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: pg_dump output 
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/


Mon, 12 Feb 2001 22:00:35 +0100 (CET)
Peter Eisentraut <peter_e@gmx.net>
Re: pg_dump output 
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


Mon, 12 Feb 2001 22:25:44 +0100 (CET)
Kovacs Zoltan <kovacsz@pc10.radnoti-szeged.sulinet.hu>
Re: pg_dump output 
Tom Lane writes:

> What are you using to inspect the file?

Ugh... :-/

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/


Mon, 12 Feb 2001 22:26:44 +0100 (CET)
Peter Eisentraut <peter_e@gmx.net>
Re: pg_dump output 
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   |/

Tue, 13 Feb 2001 09:56:41 +1100
Philip Warner <pjw@rhyme.com.au>
Re: pg_dump output 