Re: plpython function problem workaround

From: "Sim Zacks" <sim(at)compulab(dot)co(dot)il>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: plpython function problem workaround
Date: 2005-03-20 11:44:37
Message-ID: d1jnqj$1kdu$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Sorry it took me so long to respond. I've been out for a couple days.

While certain things may be permissible in a language, I think it is also
important to look at the context at which the language is applied and make a
determination if it will practically turn up in relevant code. If the answer
is no, then I think it would be acceptable to add a note that the postgresql
python implementation does not accept implicit newlines and any newlines
must be explicit (the text \r\n)

That being said, the only place I can see wanting to use a newline is for a
situation where you would want to either do a select statement with a
multiline where such as
results = plpy.execute("""...where textfield= 'multi
line
string'...""")
or if you returned the results and wanted to do the same type of thing.
if results[0]["textfield"]=="""multi
line
string""":
...

However, this example assumes that the client writing the functions and the
client inserting the data are always using the same OS, because if a linux
client inserted the data and a windows client had written the function, it
wouldn't receive any results, because postgresql sees the newline as valid
characters. hat being the case I would say that while it is entirely
possible to put multiline quoted text in python code, it would be
inappropriate in a postgresql environment.

Sim

"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote in message
news:6000(dot)1110898014(at)sss(dot)pgh(dot)pa(dot)us(dot)(dot)(dot)
> "Sim Zacks" <sim(at)compulab(dot)co(dot)il> writes:
> > I've been looking at the possibility of having a planned CR in the
source
> > code and I don't see a case where it would happen.
>
> Does python actually disallow newlines in string literals? That is
>
> x = 'foo
> bar'
>
> Whether you think this is good style is not the question --- is it
> allowed by the language?
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2005-03-20 13:18:08 Re: Installing PostgreSQL in Debian
Previous Message Sarah Ewen 2005-03-20 10:19:57 Re: pg_dump fails with socket_not_open