On 2011-02-01, Steve White <swh...@aip.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. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs