On 11-02-09 05:22 PM, Peter Eisentraut wrote:
> On tis, 2011-02-08 at 00:32 -0500, Steve Singer wrote:
>> On 11-02-06 11:40 AM, Jan Urbański wrote:
>>
>>> PFA an updated patch with documentation.
>>> Yeah, changed them.
>> Those changes look fine. The tests now pass.
>>
>> I've attached a new version of the patch that fixes a few typos/wording
>> issues I saw in the documentation. I also changed the link to the
>> python reference manual section on context managers. I think it is
>> better to link to that versus the original PEP.
>>
>> The documentation could probably still use more word-smithing but that
>> can happen later. I'm marking this as ready for a committer.
> Is it necessarily a good idea that an explicit subtransaction disables
> the implicit sub-subtransactions? It might be conceivable that you'd
> still want to do some try/catch within explicit subtransactions.
>
>
I had tested nested subtransactions but not a normal try/catch within a
subtransaction. That sounds reasonable to allow.
Unfortunately it leads to:
test=# create table foo(a int4 primary key);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"foo_pkey" for table "foo"
CREATE TABLE
test=# DO $$
test$# try:
test$# with plpy.subtransaction():
test$# plpy.execute("insert into foo values(1)")
test$# try:
test$# plpy.execute("insert into foo values(1)")
test$# except:
test$# plpy.notice('inside exception')
test$# except plpy.SPIError:
test$# f=0
test$# $$ language plpythonu;
TRAP: FailedAssertion("!(afterTriggers->query_depth ==
afterTriggers->depth_stack[my_level])", File: "trigger.c", Line: 3846)
NOTICE: inside exception
CONTEXT: PL/Python anonymous code block
server closed the connection unexpectedly This probably means the server terminated abnormally before or while
processingthe request.