Re: BUG #15983: pg_dump converts CRLF to LF

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: james(dot)inform(at)pharmapp(dot)de
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15983: pg_dump converts CRLF to LF
Date: 2019-08-29 14:33:03
Message-ID: 20554.1567089183@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> When using "pg_dump --inserts" to generate insert statements in my dump
> file, all line feeds (LF and CRLF) in e.g. text fields are converted to
> LF.

Can't reproduce that here: the dump is correctly re-imported when
I read it in psql, either with \i or with "-f".

In the --inserts form, the newlines are just going to appear verbatim
in the dump file, so they are very vulnerable to *other* tools deciding
to convert them, and I speculate that that's what happened to your file.

We could protect against that perhaps by dumping such strings using
E'...\r\n...', but that would be entirely unportable to other DBMSes.
Since the only real use-case for --inserts mode (IMO anyway) is to
transfer data to other DBMSes, that doesn't seem like a win.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Fabien COELHO 2019-08-29 14:58:18 Re: BUG #15977: Inconsistent behavior in chained transactions
Previous Message PG Bug reporting form 2019-08-29 14:07:36 BUG #15983: pg_dump converts CRLF to LF