python_commit_failure.sql
text/x-python
Filename: python_commit_failure.sql
Type: text/x-python
Part: 0
Message:
Re: fix crash with Python 3.11
create extension if not exists plpython3u;
drop table if exists testpk, testfk;
create table testpk (id int primary key);
create table testfk(f1 int references testpk deferrable initially deferred);
DO
LANGUAGE plpython3u
$$
plpy.execute("INSERT INTO testfk VALUES (0)")
try:
plpy.commit()
except Exception as e:
plpy.info('sqlstate: %s' % (e.sqlstate))
plpy.info('after exception')
plpy.execute("INSERT INTO testpk VALUES (1)")
plpy.execute("INSERT INTO testfk VALUES (1)")
$$;
table testfk;