The application "foo" uses this plpythonu source code to read the custom variable foo.transaction_id
.
I guess this is way too complicated.
How to shorten/simplify below lines?
txid_list = list(plpy.execute(
'''SELECT current_setting FROM current_setting('foo.transaction_id')'''))
txid_str = txid_list [0]['current_setting']
txid = int(txid_str)
select current_setting('foo.transaction_id')
would just be the same, but I doubt there is a big difference in performance. Not sure if it's possible in Python do do something liketxid := current_setting('foo.transaction_id')
(as in PL/pgSQL)