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

From Tom Lane
Subject Proposed ProcessUtility() API additions
Date
Msg-id 23588.1173308462@sss.pgh.pa.us
Whole thread Raw
Responses Re: Proposed ProcessUtility() API additions  (Gregory Stark <stark@enterprisedb.com>)
Re: Proposed ProcessUtility() API additions  (Heikki Linnakangas <heikki@enterprisedb.com>)
List pgsql-hackers
I'd like to change ProcessUtility to take a couple of additional
parameters, which it in turn would pass down to those (relatively few)
utility statements that need one or both:

* query_string: source text of command, if known (can be NULL)
* is_top_level: TRUE if command is being driven directly from exec_simple_query or exec_execute_message, else FALSE
(thiswould need to be passed through PortalRun, so it gets this parameter added too).
 

The point of adding query_string is that whenever parse analysis of
a sub-command is postponed until utility execution, we need to pass
the query string to parse_analyze if we want syntax error location.
This is already an issue for CREATE SCHEMA, and it's about to be
a problem for PREPARE.  There are also a couple of places that rely
on debug_query_string, which they really shouldn't be doing since
that's the current interactive command, not necessarily what's being
parsed at the moment.

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.

Comments, objections?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: RFC: changing autovacuum_naptime semantics
Next
From: Tom Lane
Date:
Subject: Re: RFC: changing autovacuum_naptime semantics