BUG #5647: COPY TO does not respect the [standard_conforming_strings] setting

Started by David Sahagianover 15 years ago3 messagesbugs
Jump to latest
#1David Sahagian
david.sahagian@gmail.com

The following bug has been logged online:

Bug reference: 5647
Logged by: David Sahagian
Email address: david.sahagian@gmail.com
PostgreSQL version: 9.0 beta4
Operating system: win XP
Description: COPY TO does not respect the
[standard_conforming_strings] setting
Details:

-
start the postgresql-9.0 service on my winXP laptop
-
verify that [standard_conforming_strings] = on
-
select a varchar(255) column from my table
using Query Tool of pgAdmin III
-
value displayed: my\n\m\\pq
this is expected by me
-
then do the COPY stmt
============
COPY( select mycol from silly_tbl )
TO $$c:\tmp\copy_to_bug.txt$$
WITH ( FORMAT text )
============
-
eyeball the output file using Notepad
value displayed: my\\n\\m\\\\pq
-

So all the backslash chars got "doubled".

My claim is . . .
if
standard_conforming_strings = on
then
COPY TO should NOT be modifying the data values
with extra backslashes
.

Notes:
I want to use the output file as input to psql, for another db whose
[standard_conforming_strings] is also = on. The current behavior of COPY TO
makes that impossible.

Thanks,
-dvs-

-dvs-

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: David Sahagian (#1)
Re: BUG #5647: COPY TO does not respect the [standard_conforming_strings] setting

"David Sahagian" <david.sahagian@gmail.com> writes:

Description: COPY TO does not respect the
[standard_conforming_strings] setting

This is not a bug. The COPY format is well defined and is not going to
be changed by standard_conforming_strings.

I want to use the output file as input to psql, for another db whose
[standard_conforming_strings] is also = on. The current behavior of COPY TO
makes that impossible.

That's nonsense. standard_conforming_strings won't affect the
interpretation of COPY data on either machine. If we were to change it
as you suggest, then we *would* have a compatibility problem.

regards, tom lane

#3Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#2)
Re: BUG #5647: COPY TO does not respect the [standard_conforming_strings] setting

Tom Lane wrote:

"David Sahagian" <david.sahagian@gmail.com> writes:

Description: COPY TO does not respect the
[standard_conforming_strings] setting

This is not a bug. The COPY format is well defined and is not going to
be changed by standard_conforming_strings.

Yes, remember COPY data are not "strings", they are delimited data, so
there is no standard to match here.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +