Re: plpython

From: "Harald Armin Massa" <haraldarminmassa(at)gmail(dot)com>
To: km(at)mrna(dot)tn(dot)nic(dot)in
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: plpython
Date: 2006-10-27 14:21:30
Message-ID: 7be3f35d0610270721y195b5ba0g221aa37191e7d9d0@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

KM,

>
> Can someone hint on resources for using plpython for writing stored
> procedures ?
> I have gone thru official docs for 8.1.5 for plpythonu but its not in
> detail/with examples.

CREATE OR REPLACE FUNCTION myfunc(text)
RETURNS text AS
$BODY$
eingabe=args[0]
hello = "Good Morning %s" % (eingabe,)

return hello
$BODY$
LANGUAGE 'plpythonu' VOLATILE;
ALTER FUNCTION myfunc(text) OWNER TO postgres;

that as a first example to get you started. The other one I could give you
is using Pyro, which brings in rather uncommon challenges.

>When is plpython going to be considered safe ? any targeted version ?

Hey, you fell into the same "safe" and "unsafe" trap than me!

"unsafe" does not have the information: "it is possibly errorprone to use
this language"

"unsafe" simply says: "it is impossible for the database to guarantee, that
a bad minded programmer can do harmfull thins with this language"

For example: with plpython you can read and delete files on the server.
There is no way for PostgreSQL to stop plpython from doing harm; so it is
considered "unsafe".

(Btw: there is no restricted mode of execution for Python, google the Python
Mailingslists for it; "sandbox" is a helpfull keyword)

So: plpython is only recommended to be used by trustworthy programmers. Not
by the general public.

Harald

--
GHUM Harald Massa
persuadere et programmare
Harald Armin Massa
Reinsburgstraße 202b
70197 Stuttgart
0173/9409607
-
Python: the only language with more web frameworks than keywords.

In response to

  • plpython at 2006-10-27 13:31:02 from km

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-10-27 14:46:40 Re: pg_dumpall failing from possible corrupted shared memory
Previous Message Taras Kopets 2006-10-27 14:04:54 Re: Send email from PostgreSQL, may I ?