Skip site navigation (1) Skip section navigation (2)

Re: Pl/Python -- current maintainer?

From: James William Pye <pgsql(at)jwp(dot)name>
To: Tino Wildenhain <tino(at)wildenhain(dot)de>
Cc: James Robinson <jlrobins(at)socialserve(dot)com>,"Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>,Hackers Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Pl/Python -- current maintainer?
Date: 2006-02-25 20:21:34
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Sat, Feb 25, 2006 at 10:09:52AM +0100, Tino Wildenhain wrote:
> And with even more love the restricted python from zope could
> be ported so there could be a pl/python again :-)
> Ok, just haluzinating ;)

Not necessarily. ;)

From what I have seen of zope's restricted python, it does, or can, force its
restrictions by checking bytecode. I imagine a simple PL sitting on top of the
untrusted varient that merely implements a custom validator that checks the
bytecode produced by the untrusted PL's validator. The language handler would
remain the same:

<Create untrusted plpy...>

getcode = Postgres.CachedQuery("SELECT probin FROM pg_proc WHERE oid = $1")
getlangval = Postgres.CachedQuery("""
	SELECT lanvalidator FROM pg_language WHERE
		oid = (SELECT prolang FROM pg_proc WHERE oid = $1)

langvaloid = getlangval(self.function.procid)
langval = Postgres.Function(langvaloid)

# produce the function's bytecode for checking

# get the function's newly created bytecode
code = getcode(args[0]).next()[0]

# XXX: do the zope restriction stuff, raise exception if necessary


CREATE TRUSTED LANGUAGE plpyr HANDLER python.handler VALIDATOR zope_restrict;

[This almost works in plpy head, but I think I just found a bug ;]
Regards, James William Pye

In response to


pgsql-hackers by date

Next:From: Stephan SzaboDate: 2006-02-25 20:37:24
Subject: Re: constraints and sql92 information_schema compliance
Previous:From: Clark C. EvansDate: 2006-02-25 20:01:11
Subject: Re: constraints and sql92 information_schema compliance

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group