Skip site navigation (1) Skip section navigation (2)

Re: Double newline bug with DBD::Pg: Where best to fix?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dan Lyke <danlyke(at)flutterby(dot)com>, pgsql-interfaces(at)postgresql(dot)org, Peter Eisentraut <peter_e(at)gmx(dot)net>
Subject: Re: Double newline bug with DBD::Pg: Where best to fix?
Date: 2001-02-27 20:27:03
Message-ID: 9388.983305623@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-interfaces
>> 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 string
 with 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 string
 with 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

In response to

Responses

pgsql-interfaces by date

Next:From: Dan LykeDate: 2001-02-27 20:39:47
Subject: Re: Double newline bug with DBD::Pg: Where best to fix?
Previous:From: Tom LaneDate: 2001-02-27 20:21:58
Subject: Re: Double newline bug with DBD::Pg: Where best to fix?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group