[no subject]
<Create untrusted plpy...>
CREATE FUNCTION zope_restrict(oid) RETURNS VOID LANGUAGE python AS
$$
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
langval(args[0])
# get the function's newly created bytecode
code = getcode(args[0]).next()[0]
#
# XXX: do the zope restriction stuff, raise exception if necessary
#
Postgres.NOTICE(repr(code))
$$;
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
Home |
Main Index |
Thread Index