Re: Proposed ProcessUtility() API additions - Mailing list pgsql-hackers

From Gregory Stark
Subject Re: Proposed ProcessUtility() API additions
Date
Msg-id 87d53k8sqa.fsf@stark.xeocode.com
Whole thread Raw
In response to Proposed ProcessUtility() API additions  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Proposed ProcessUtility() API additions  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers

"Tom Lane" <tgl@sss.pgh.pa.us> writes:

> * is_top_level: TRUE if command is being driven directly from
>   exec_simple_query or exec_execute_message, else FALSE (this would
>   need to be passed through PortalRun, so it gets this parameter added
>   too).

...

> The point of adding is_top_level is to provide a simpler, more reliable
> means for PreventTransactionChain and related functions to detect
> whether a function is trying to invoke a non-transaction-block-safe
> command.  Currently we rely on an ugly test involving seeing if the
> statement node is in the QueryContext, but that's always been a kluge,
> and I'm not sure that it works 100% even today.  I'd like to get rid
> of the QueryContext global altogether.

I'm not exactly following. How does the exec_simple_query or
exec_execute_message tell you whether you're in a transaction?

Can't you exec_simple_query("BEGIN;") and then exec_simple_query a second
query in the same transaction?

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Gregory Stark
Date:
Subject: Re: WITH/RECURSIVE plans
Next
From: Gregory Stark
Date:
Subject: Re: Grouped Index Tuples / Clustered Indexes