Re: PL/pgSQL nested CALL with transactions

2018-03-28 Thread Peter Eisentraut
On 3/28/18 09:00, Tomas Vondra wrote: > I see. I thought "fixed" means you adopted the #define, but that's not > the case. I don't think an extra comment is needed - the variable name > is descriptive enough IMHO. Committed as presented then. Thanks. -- Peter Eisentraut http://www.

Re: PL/pgSQL nested CALL with transactions

2018-03-28 Thread Tomas Vondra
On 03/28/2018 02:54 PM, Peter Eisentraut wrote: > On 3/27/18 20:43, Tomas Vondra wrote: 3) utility.c I find this condition rather confusing: (!(context == PROCESS_UTILITY_TOPLEVEL || context == PROCESS_UTILITY_QUERY_NONATOMIC) || IsTransactionB

Re: PL/pgSQL nested CALL with transactions

2018-03-28 Thread Peter Eisentraut
On 3/27/18 20:43, Tomas Vondra wrote: >>> 3) utility.c >>> >>> I find this condition rather confusing: >>> >>> (!(context == PROCESS_UTILITY_TOPLEVEL || >>>context == PROCESS_UTILITY_QUERY_NONATOMIC) || >>>IsTransactionBlock()) >>> >>> I mean, negated || with another || - it too

Re: PL/pgSQL nested CALL with transactions

2018-03-27 Thread Tomas Vondra
On 03/24/2018 03:14 PM, Peter Eisentraut wrote: > On 3/22/18 11:50, Tomas Vondra wrote: > >> 2) spi.c >> >> I generally find it confusing when there are negative flags, which are >> then negated whenever used. That is pretty the "no_snapshots" case, >> because it means "don't manage snapshots" a

Re: PL/pgSQL nested CALL with transactions

2018-03-24 Thread Peter Eisentraut
On 3/22/18 11:50, Tomas Vondra wrote: > 1) plpgsql.sgml > > The new paragraph talks about "intervening command" - I've been unsure > what that refers too, until I read the comment for ExecutCallStmt(), > which explains this as CALL -> SELECT -> CALL. Perhaps we should add > that to the sgml docs t

Re: PL/pgSQL nested CALL with transactions

2018-03-22 Thread Tomas Vondra
Hi, The patch looks good to me - certainly in the sense that I haven't found any bugs during the review. I do have a couple of questions and comments about possible improvements, though. Some of this may be a case of bike-shedding or simply because I've not looked as SPI/plpgsql before. 1) plpgs

Re: PL/pgSQL nested CALL with transactions

2018-03-16 Thread Pavel Stehule
2018-03-16 18:49 GMT+01:00 Tom Lane : > Pavel Stehule writes: > > 2018-03-16 18:35 GMT+01:00 Peter Eisentraut < > > peter.eisentr...@2ndquadrant.com>: > >> Not very typical, but we apply the same execution context handling to > >> CALL and DO at the top level, so it would be weird not to propagat

Re: PL/pgSQL nested CALL with transactions

2018-03-16 Thread Tom Lane
Pavel Stehule writes: > 2018-03-16 18:35 GMT+01:00 Peter Eisentraut < > peter.eisentr...@2ndquadrant.com>: >> Not very typical, but we apply the same execution context handling to >> CALL and DO at the top level, so it would be weird not to propagate that. > Although it is possible, I don't see a

Re: PL/pgSQL nested CALL with transactions

2018-03-16 Thread Pavel Stehule
2018-03-16 18:35 GMT+01:00 Peter Eisentraut < peter.eisentr...@2ndquadrant.com>: > On 3/16/18 00:24, Pavel Stehule wrote: > > What is benefit of DO command in PLpgSQL? Looks bizarre for me. > > Not very typical, but we apply the same execution context handling to > CALL and DO at the top level, so

Re: PL/pgSQL nested CALL with transactions

2018-03-16 Thread Peter Eisentraut
On 3/16/18 00:24, Pavel Stehule wrote: > What is benefit of DO command in PLpgSQL? Looks bizarre for me. Not very typical, but we apply the same execution context handling to CALL and DO at the top level, so it would be weird not to propagate that. -- Peter Eisentraut http://www.2nd

Re: PL/pgSQL nested CALL with transactions

2018-03-15 Thread Pavel Stehule
Hi 2018-03-16 2:57 GMT+01:00 Peter Eisentraut : > On 2/28/18 14:51, Peter Eisentraut wrote: > > So far, a nested CALL or DO in PL/pgSQL would not establish a context > > where transaction control statements were allowed. This patch fixes > > that by handling CALL and DO specially in PL/pgSQL, pa

Re: PL/pgSQL nested CALL with transactions

2018-03-15 Thread Peter Eisentraut
On 2/28/18 14:51, Peter Eisentraut wrote: > So far, a nested CALL or DO in PL/pgSQL would not establish a context > where transaction control statements were allowed. This patch fixes > that by handling CALL and DO specially in PL/pgSQL, passing the > atomic/nonatomic execution context through and