plpythonu and dollar quoting

Lists: pgsql-general
From: CSN <cool_screen_name90001(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: plpythonu and dollar quoting
Date: 2005-05-03 21:46:04
Message-ID: 20050503214604.89538.qmail@web52905.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Can dollar quoting be used with plpythonu (like with
plperl -
http://www.postgresql.org/docs/8.0/interactive/plperl.html#PLPERL-FUNCS)?
When trying to create a function I get this error:

'syntax error at or near "$"'

If I use single quotes, then escape all quotes and (a
lot of) backslashes in the python code then the
function gets created fine.

CSN

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


From: Michael Fuhr <mike(at)fuhr(dot)org>
To: CSN <cool_screen_name90001(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: plpythonu and dollar quoting
Date: 2005-05-03 22:29:43
Message-ID: 20050503222943.GB59722@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Tue, May 03, 2005 at 02:46:04PM -0700, CSN wrote:
>
> Can dollar quoting be used with plpythonu (like with plperl -

Yes, if you're using PostgreSQL 8.0 or later. Dollar quotes have
nothing to do with the function's language -- they're just another
way to quote a string.

http://www.postgresql.org/docs/8.0/interactive/sql-syntax.html#SQL-SYNTAX-DOLLAR-QUOTING

> When trying to create a function I get this error:
>
> 'syntax error at or near "$"'

This is the error you'd get if you tried to use dollar quotes in
PostgreSQL 7.4; you'd get a similar error in earlier versions. What
version are you using? What does "SELECT version();" show?

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