From: | Jasen Betts <jasen(at)xnet(dot)co(dot)nz> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: Feature request: include script file into function body |
Date: | 2011-02-03 12:01:32 |
Message-ID: | iie5es$b91$2@reversiblemaps.ath.cx |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On 2011-02-02, Steve White <swhite(at)aip(dot)de> wrote:
> Hi, Robert,
>
> I made a file 'yadda_yadda.py' containing only the line:
> print 'hello world'
>
>====================================================================
> d=# \set yadda `cat yadda_yadda.py`
> d=# \echo :yadda
> print 'hello world'
>====================================================================
> But the :'yadda'; produces an error--it seems the variable yadda isn't
> expanded in the presence of the quotes.
yes, \set doesn't quote content
\set yadda '''' `sed -e "s/'/''/g" -e 's/\\/\\\\/g' < yadda_yadda.py` ''''
CREATE FUNCTION yadda_yadda() returns text language plpythonu AS
E:yadda;
this is not much help for windows users though.
BTW I found that sed command on the psql man page.
--
⚂⚃ 100% natural
From | Date | Subject | |
---|---|---|---|
Next Message | Jasen Betts | 2011-02-03 12:05:04 | Re: Feature request: include script file into function body (better syntax) |
Previous Message | Jasen Betts | 2011-02-03 11:37:21 | Re: Feature request: include script file into function body |