On 2019-12-09 23:32, Tom Lane wrote:
> * In the docs section beginning "Context managers syntax using the with
> keyword", could we drop that entire <sect2>? It seems like it's now not
> saying much more than "you can use this standard python feature", which
> is hardly surprising information.
That section points out the existence of the subxact.enter() and
subxact.exit() methods. New code wouldn't need to use those, but
someone might find them in old code, so it would be good to have them at
least mentioned somewhere. Maybe it could be rewritten, but I hesitate
to remove it completely.
> * I'm not sure it's a good idea to remove the test case you removed
> from plpython_subtransaction.sql. We still need to support user
> code written that way, don't we?
The main purpose of that test case was that older Python versions can
test this functionality at all, because most of the rest of the file
would fail with Python syntax errors around the "with" keyword. With
newer Python versions there is IMO no need to test both the "with"
variant and the equivalent __enter__+__exit__ variant separately,
because that would just show that Python itself works correctly. Then
again, we could keep it for completeness and clarity.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services