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

Re: plpython function problem workaround

From: Sim Zacks <sim(at)compulab(dot)co(dot)il>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: plpython function problem workaround
Date: 2005-03-29 10:04:14
Message-ID: 1857243712.20050329120414@compulab.co.il (view raw or flat)
Thread:
Lists: 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(at)postgresql(dot)org


In response to

Responses

pgsql-general by date

Next:From: Harald FuchsDate: 2005-03-29 11:23:46
Subject: Re: Tracking row updates - race condition
Previous:From: joseph antonyrajDate: 2005-03-29 09:20:02
Subject: How to copy from Table to table

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