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 11:37:21 |
Message-ID: | iie41h$b91$1@reversiblemaps.ath.cx |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On 2011-02-01, Steve White <swhite(at)aip(dot)de> wrote:
> Hi
>
> I asked on pgsql-general 31 Jan 2011 if there were a way to do this, and got
> no response, so let's make it a feature request.
>
> It would be really nice to have a way to load script (especially Python
> and Perl) from a separate file into a function body. Some advantages would
> be: to run a code checker outside of Postgresql, and to make things easier
> for source code colorizers.
>
> I have in mind syntax something like>
>================================================
> CREATE OR REPLACE FUNCTION
> myfunc( ... )
> RETURNS VOID FROM 'ScriptFile.py' LANGUAGE PLPYTHONU;
>================================================
others have complained about the backend reading files
maybe this coould be implemented in PSQL instead.
(like \i and \copy are...)
something like:
\CREATE OR REPLACE FUNCTION myfunc( ... ) RETURNS VOID FROM 'ScriptFile.py' LANGUAGE PLPYTHONU
psql would then need to slurp the file and quote the function body, but
pq_escape_string_conn is presumably upto that task.
on the other hand binary fuunctions (eg C) are read from files, but
not directly by the backend, dlopen (or equivalent) is used instead.
on the other hand, for symmetry I guess a form that matches yours is
needed too, but, if using named files that will probably need database
superuser permission (like the other named file functions do).
Then ther could be an unpriviledged "from stdin" variant that psql could
use to send the content (instead of quoting it and sending it in-line).
ISTR C functions need superuser too.
From | Date | Subject | |
---|---|---|---|
Next Message | Jasen Betts | 2011-02-03 12:01:32 | Re: Feature request: include script file into function body |
Previous Message | Craig Ringer | 2011-02-03 03:31:39 | Re: BUG #5862: Postgres dumps core upon a connection attempt |