On 09/25/2016 08:39 AM, Tom Lane wrote: > Charles Clavadetscher <clavadetscher@xxxxxxxxxxxx> writes: >> Honestly I still don't understand why this happened this way. > > I wonder if you have standard_conforming_strings turned off, or > did when that data was inserted. That would change the behavior > of backslashes in string literals. That got me to thinking: standard_conforming_strings = on test=# create table test (txt text); CREATE TABLE test=# insert into test values ('BEGIN:VCARD\r\\rVERSION:3.0\r\\rN:Halbritter;Ursula;;;\r\\rFN:Ursula Halbritter\r\\rEMAIL;TYPE=INTERNET;TYPE=HOME:ursula.halbritter@xxxxxxxxxxxx\r\\rADR;TYPE=home:;;strasse;schwerzenbach;;;ooooooooooooooooooooooooooo\r\\rEND:VCARD'); INSERT 0 1 test=# insert into test values (E'BEGIN:VCARD\r\\rVERSION:3.0\r\\rN:Halbritter;Ursula;;;\r\\rFN:Ursula Halbritter\r\\rEMAIL;TYPE=INTERNET;TYPE=HOME:ursula.halbritter@xxxxxxxxxxxx\r\\rADR;TYPE=home:;;strasse;schwerzenbach;;;ooooooooooooooooooooooooooo\r\\rEND:VCARD'); INSERT 0 1 test=# \copy test to test.txt COPY 2 cat test.txt BEGIN:VCARD\\r\\\\rVERSION:3.0\\r\\\\rN:Halbritter;Ursula;;;\\r\\\\rFN:Ursula Halbritter\\r\\\\rEMAIL;TYPE=INTERNET;TYPE=HOME:ursula.halbritter@xxxxxxxxxxxx\\r\\\\rADR;TYPE=home:;;strasse;schwerzenbach;;;ooooooooooooooooooooooooooo\\r\\\\rEND:VCARD BEGIN:VCARD\r\\rVERSION:3.0\r\\rN:Halbritter;Ursula;;;\r\\rFN:Ursula Halbritter\r\\rEMAIL;TYPE=INTERNET;TYPE=HOME:ursula.halbritter@xxxxxxxxxxxx\r\\rADR;TYPE=home:;;strasse;schwerzenbach;;;ooooooooooooooooooooooooooo\r\\rEND:VCARD standard_conforming_strings = off test=# truncate test; TRUNCATE TABLE test=# insert into test values ('BEGIN:VCARD\r\\rVERSION:3.0\r\\rN:Halbritter;Ursula;;;\r\\rFN:Ursula Halbritter\r\\rEMAIL;TYPE=INTERNET;TYPE=HOME:ursula.halbritter@xxxxxxxxxxxx\r\\rADR;TYPE=home:;;strasse;schwerzenbach;;;ooooooooooooooooooooooooooo\r\\rEND:VCARD'); WARNING: nonstandard use of escape in a string literal LINE 1: insert into test values ('BEGIN:VCARD\r\\rVERSION:3.0\r\\rN:... ^ HINT: Use the escape string syntax for escapes, e.g., E'\r\n'. INSERT 0 1 test=# insert into test values (E'BEGIN:VCARD\r\\rVERSION:3.0\r\\rN:Halbritter;Ursula;;;\r\\rFN:Ursula Halbritter\r\\rEMAIL;TYPE=INTERNET;TYPE=HOME:ursula.halbritter@xxxxxxxxxxxx\r\\rADR;TYPE=home:;;strasse;schwerzenbach;;;ooooooooooooooooooooooooooo\r\\rEND:VCARD'); INSERT 0 1 test=# \copy test to test_off.txt COPY 2 cat test_off.txt BEGIN:VCARD\r\\rVERSION:3.0\r\\rN:Halbritter;Ursula;;;\r\\rFN:Ursula Halbritter\r\\rEMAIL;TYPE=INTERNET;TYPE=HOME:ursula.halbritter@xxxxxxxxxxxx\r\\rADR;TYPE=home:;;strasse;schwerzenbach;;;ooooooooooooooooooooooooooo\r\\rEND:VCARD BEGIN:VCARD\r\\rVERSION:3.0\r\\rN:Halbritter;Ursula;;;\r\\rFN:Ursula Halbritter\r\\rEMAIL;TYPE=INTERNET;TYPE=HOME:ursula.halbritter@xxxxxxxxxxxx\r\\rADR;TYPE=home:;;strasse;schwerzenbach;;;ooooooooooooooooooooooooooo\r\\rEND:VCARD > > regards, tom lane > > -- Adrian Klaver adrian.klaver@xxxxxxxxxxx -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general