Re: plpython function problem workaround - Mailing list pgsql-general

From Sim Zacks
Subject Re: plpython function problem workaround
Date
Msg-id 1857243712.20050329120414@compulab.co.il
Whole thread Raw
In response to Re: plpython function problem workaround  (Michael Fuhr <mike@fuhr.org>)
Responses Re: plpython function problem workaround
List pgsql-general
The only ?issue? that I have found with it is similar to an issue I
posted about multiline in general, which does not seem to be
considered a bug.
I would say if it is documented that any newlines in a python
function, including embedded newlines, are *NIX newlines no matter
what operating system the function is created on, that would suffice.

As an example - Windows PGAdmin client. Linux Server:
create table test1(f1 varchar(50));

insert into test1 values('this is a multi line string
line2
line3
')

select * from test1 where f1='this is a multi line string
line2
line3
'
--returns 1 row

create or replace function testnewlines() returns int as
$$
x=plpy.execute("""select f1 from test1 where f1='this is a multi line string\r\nline2\r\nline3\r\n'""")
return x.nrows()
$$ language 'plpythonu'
--returns 1

create or replace function testnewlines() returns int as
$$
x=plpy.execute("""select f1 from test1 where f1='this is a multi line string
line2
line3
'""")
return x.nrows()
$$ language 'plpythonu'

--returns 0
Thank You
Sim Zacks


________________________________________________________________________________

On Fri, Mar 18, 2005 at 10:12:05PM -0700, Michael Fuhr wrote:
>
> I just submitted a small patch to convert CRLF => LF, CR => LF.

This patch is in 8.0.2beta1, so PL/Python users might want to test
it before 8.0.2 is released.  See the recent "8.0.2 Beta Available"
announcement:

http://archives.postgresql.org/pgsql-general/2005-03/msg01311.php

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org


pgsql-general by date:

Previous
From: Robin Ericsson
Date:
Subject: Re: LWM 2004 Readers' Choice Nomination
Next
From: Harald Fuchs
Date:
Subject: Re: Tracking row updates - race condition