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

From David
Subject Re: plpython function problem workaround
Date
Msg-id 20050315133305.GA6529@localhost.localdomain
Whole thread Raw
In response to Re: plpython function problem workaround  ("Sim Zacks" <sim@compulab.co.il>)
Responses Re: plpython function problem workaround  (Ragnar Hafstað <gnari@simnet.is>)
List pgsql-general
On Tue, Mar 15, 2005 at 08:09:47AM +0200, Sim Zacks wrote:
> I don't think that this type of solution should be discussed as an official
> patch.
> If it was, I would recommend solving the problem in source code when the
> function is passed to the translator. That way each platform could fix the
> code to work with as is needed and the code would be portable.
>
> I ran into this problem about half a year ago and it didn't go anywhere,
> then I saw a long discussion about it that also didn't go anywhere. I had
> given up on using plpython until now because I actually need it.

I'd like to insert one note here.  While I'm not particularly familiar
with either perl or python, when I encountered the referred-to thread
regarding Windows/Unix newline incompatibilities in Python, I ran some
tests on my Linux system.  I wrote some very simple scripts in Perl and
Python and tested them.  They ran OK when I saved them in native Linux
newlines, they ran, but if I saved them in DOS mode (vim), neither the
Python nor the Perl scripts would run.  I noted that some of the writers
in that thread were critical of Python for not taking care of the
conversions, and it may be that the Perl interfaces in postgresql may
take care of this, I have not tried this, but it seems that my tests, if
valid, indicate that this problem is not restricted to Python alone as
far as the interpreters are concerned.

This observation may have nothing to do with the pl/Perl and pl/Python
interfaces, but I thought I'd pass this along FWIW.

> So I
> figured out how to make it work and thought that it would be helpful to
> others, but I couldn't figure out how to automate the fix.
>
> "Tom Lane" <tgl@sss.pgh.pa.us> wrote in message

> > I don't know Python at all, so I don't know how complicated its lexical
> > structure is, but ISTM you'd at least need enough smarts to distinguish
> > literals from unquoted whitespace.
> >
> > The other small fly in the ointment is that when the server is running
> > on Windows, I suppose we would have to *put in* rather than remove CRs.
> > Sim probably doesn't care about that case, but we couldn't accept an
> > official patch that doesn't handle it.

pgsql-general by date:

Previous
From: tony
Date:
Subject: Re: Localization problems between Access and PostgresSQL
Next
From: Martijn van Oosterhout
Date:
Subject: Re: Filesystem level backup and 32 / 64 bit