Re: pl/python explicit subtransactions

From: Steve Singer <ssinger_pg(at)sympatico(dot)ca>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Jan Urbański <wulczer(at)wulczer(dot)org>, Postgres - Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pl/python explicit subtransactions
Date: 2011-02-10 00:26:31
Message-ID: BLU0-SMTP7880F6FF9D4EC4C27F71A8EEC0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 processing the request.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2011-02-10 00:30:54 another mvcc.sgml typo
Previous Message Greg Stark 2011-02-09 23:48:27 Re: new clang report