Re: Postgres automatically inserts chr(13) whenever chr(10) is inserted

Поиск
Список
Период
Сортировка
Искать

Re: Postgres automatically inserts chr(13) whenever chr(10) is inserted

От:
Michael Fuhr <mike@fuhr.org>
Дата:
On Fri, Mar 03, 2006 at 08:47:00AM +0100, Dragan Matic wrote:
> create table sample(column_sample varchar(500))
> 
> insert into sample(column_sample) values('this is first row of text' || 
> chr(10) || 'this is second row of text')
> 
> Now, instead of just inserting chr(10), postgres inserts chr(13) + 
> chr(10). Is there a way to avoid this? Database is on a linux server 
> with SQL_ASCII encoding, clients are winXP communicating thru ODBC.

How did you determine what characters are being inserted?  What's
the output of the following example?

INSERT INTO sample VALUES ('a' || chr(10) || 'b');
SELECT length(column_sample), decode(column_sample, 'escape') FROM sample;

-- 
Michael Fuhr

Re: Postgres automatically inserts chr(13) whenever chr(10) is inserted

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Dragan Matic  writes:
> create table sample(column_sample varchar(500))
> insert into sample(column_sample) values('this is first row of text' || 
> chr(10) || 'this is second row of text')

> Now, instead of just inserting chr(10), postgres inserts chr(13) + 
> chr(10).

Postgres most certainly does not do that, as even a moment's
experimentation (eg, with length()) will prove to you.  Take a closer
look at your client-side software to find out where the newline
conversion is happening.

			regards, tom lane

Postgres automatically inserts chr(13) whenever chr(10) is inserted

От:
Dragan Matic <mlists@panforma.co.yu>
Дата:
create table sample(column_sample varchar(500))

insert into sample(column_sample) values('this is first row of text' || 
chr(10) || 'this is second row of text')

Now, instead of just inserting chr(10), postgres inserts chr(13) + 
chr(10). Is there a way to avoid this? Database is on a linux server 
with SQL_ASCII encoding, clients are winXP communicating thru ODBC.

Tnx in advance

DRagan Matic


FAQ