pgsql: Make UtilityContainsQuery recurse until it finds a non-utility Q

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Make UtilityContainsQuery recurse until it finds a non-utility Q
Дата
Msg-id E1Sk5G0-0004xP-Vn@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Make UtilityContainsQuery recurse until it finds a non-utility Query.

The callers of UtilityContainsQuery want it to return a non-utility Query
if it returns anything at all.  However, since we made CREATE TABLE
AS/SELECT INTO into a utility command instead of a variant of SELECT,
a command like "EXPLAIN SELECT INTO" results in two nested utility
statements.  So what we need UtilityContainsQuery to do is drill down
to the bottom non-utility Query.

I had thought of this possibility in setrefs.c, and fixed it there by
looping around the UtilityContainsQuery call; but overlooked that the call
sites in plancache.c have a similar issue.  In those cases it's
notationally inconvenient to provide an external loop, so let's redefine
UtilityContainsQuery as recursing down to a non-utility Query instead.

Noted by Rushabh Lathia.  This is a somewhat cleaned-up version of his
proposed patch.

Branch
------
REL9_2_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/c8967e38a65e4afac7027d570136ca6dac5cacc1

Modified Files
--------------
src/backend/optimizer/plan/setrefs.c |    2 +-
src/backend/tcop/utility.c           |   26 ++++++++++++++++++++------
2 files changed, 21 insertions(+), 7 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: pgsql: Fix install program detection
Следующее
От: Robert Haas
Дата:
Сообщение: pgsql: Add missing space in event_source GUC description.