Re: BUG #3795: pg_dump is mis-dumping columns containing line breaks

From: lou(at)paprikash(dot)com
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #3795: pg_dump is mis-dumping columns containing line breaks
Date: 2007-12-02 22:52:52
Message-ID: 4752F0F4.23452.1DF08399@lou.paprikash.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> "Lou Duchez" <lou(at)paprikash(dot)com> writes:
> > My copy of PostgreSQL has standard_conforming_strings set to "on", and when
> > I attempt to pg_dump tables that have strings containing CR/LFs, the data
> > dumps in a format that psql cannot then reload.
>
> It works fine here. Please provide a *complete* example of what you
> are doing.
>
> regards, tom lane
>

Hello,

Here is a complete example. I have two Windows servers, one with PostgreSQL 8.2.5, the
other with 8.3 beta 3. Both have standard_conforming_strings set to "on". My "test"
database is UTF8 on each server. I perform the following steps on each server:

1) Using pgAdmin III version 1.8, I create a table in my "test" database:

CREATE TABLE testtable
(
column1 character varying(200) DEFAULT '',
PRIMARY KEY (column1)
) WITH (OIDS=FALSE);

2) Again using pgAdmin, I add two rows to the table:

insert into testtable (column1) values ('This
is
a
multi
row
string'),
('This
is
another
multi
row
string');

3) Then I run the following pg_dump command:

pg_dump -U postgres -E LATIN1 -t testtable testdatabase

The two versions of PostgreSQL produce slightly different results. 8.2.5 generates the
following "COPY" command:

COPY testtable (column1) FROM stdin;
This\nis\na\nmulti\nrow\nstring
This\nis\nanother\nmulti\nrow\nstring
\.

8.3 beta 3 generates the following "COPY" command:

COPY testtable (column1) FROM stdin;
This\
is\
a\
multi\
row\
string
This\
is\
another\
multi\
row\
string
\.

The 8.3 version, with the unescaped line breaks, confuses the heck out of psql.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2007-12-02 23:24:09 Re: BUG #3795: pg_dump is mis-dumping columns containing line breaks
Previous Message Tom Lane 2007-12-02 21:29:54 Re: BUG #3795: pg_dump is mis-dumping columns containing line breaks