>> test=# insert into xyz(stuff) values('a string with
>> test'#
>> test'# a two line break');
>> test=# select stuff from xyz;
>> stuff
>> ----------------------------------
>> a string with
>> a two line break
>> (1 row)
>> (As you can see there are also some interesting issues with leading
>> spaces going on here).
On closer look, there is no leading-space issue. Psql is formatting the
column with a leading space as it usually does, and the newline-space
in the string is just being echoed. Compare:
regression=# select 'a string without a newline'; ?column?
----------------------------a string without a newline
(1 row)
regression=# select 'a string\nwith a newline'; ?column?
-------------------------a string
with a newline
(1 row)
regression=# select 'a string\n with a newline'; ?column?
--------------------------a stringwith a newline
(1 row)
regression=# select 'a string
regression'# with a newline'; ?column?
-------------------------a string
with a newline
(1 row)
regression=# select 'a string
regression'# with a newline'; ?column?
--------------------------a stringwith a newline
(1 row)
That's all fine IMHO. But this isn't:
regression=# select 'a string
regression'#
regression'# with a newline'; ?column?
-------------------------a string
with a newline
(1 row)
regards, tom lane