python-postgres / be

pg-python: Execute Python 3 code from PostgreSQL functions.
Other
5 stars 2 forks source link

Crash on Postgres.Function.input[0] access #32

Open jwp opened 12 years ago

jwp commented 12 years ago

The access at Postgres.terminate_backend.input[0] causes a crash:

CREATE OR REPLACE FUNCTION py_backend_control() RETURNS text LANGUAGE python AS
$python$
import Postgres

def main():
   # validate what we can, and be done. :(
   assert isinstance(Postgres.terminate_backend, Postgres.Function)
   assert Postgres.terminate_backend.input[0]['atttypid'] == Postgres.CONST["INT4OID"]
   assert isinstance(Postgres.cancel_backend, Postgres.Function)
   assert Postgres.cancel_backend.input[0]['atttypid'] == Postgres.CONST["INT4OID"]
   return 'success'
$python$;

-- pretty weak test :(
SELECT py_backend_control();