Re: Feature request: include script file into function body

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: Steve White <swhite(at)aip(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Feature request: include script file into function body
Date: 2011-02-01 21:55:12
Message-ID: AANLkTi=7C8xFYF7uQW0y+si8oNdKoY2NX8jc4bU0GWvY@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Feb 1, 2011 at 3:09 PM, Kevin Grittner
<Kevin(dot)Grittner(at)wicourts(dot)gov> wrote:
> Steve White <swhite(at)aip(dot)de> wrote:
>> On  1.02.11, Tom Lane wrote:
>>> "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> writes:
>>>> Maybe some option for the \i command?  \iq (for input quoted)
>>>> with automatic $$ quoting around what is read?
>>>
>>>> That way you could do something like:
>>>
>>>> CREATE FUNCTION yadda_yadda() returns text language plpythonu as
>>>> \iq yadda_yadda.py
>>>> ;
>>
>> Yes this will work for me.
>>
>>>
>>> Just got this --- looks like we independently arrived at the same
>>> conclusion.
>
> I'll add it to the TODO list.  It looks like we might finally have a
> good one for those looking for an easy item from that list.  Those
> have been scarce lately.

Can't you already do it this way:

\set yadda `cat yadda_yadda.py`
CREATE FUNCTION yadda_yadda() returns text language plpythonu AS
:'yadda';

I guess it probably won't work on Windows...

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kevin Grittner 2011-02-01 22:22:54 Re: Feature request: include script file into function body
Previous Message Kevin Grittner 2011-02-01 20:09:39 Re: Feature request: include script file into function body