From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Add public ruleutils.c entry point to deparse a Query. |
Date: | 2022-03-28 15:19:48 |
Message-ID: | E1nYr9n-001luN-Vg@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Add public ruleutils.c entry point to deparse a Query.
This has no in-core callers but will be wanted by extensions.
It's just a thin wrapper around get_query_def, so it adds little code.
Also, fix get_from_clause_item() to force insertion of an alias
for a SUBQUERY RTE item. This is irrelevant to existing uses because
RTE_SUBQUERY items made by the parser always have aliases already.
However, if one tried to use pg_get_querydef() to inspect a post-rewrite
Query, it could be an issue. In any case, get_from_clause_item already
contained logic to force alias insertion for VALUES items, so the lack
of the same for SUBQUERY is a pretty clear oversight.
In passing, replace duplicated code for selection of pretty-print
options with a common macro.
Julien Rouhaud, reviewed by Pavel Stehule, Gilles Darold, and myself
Discussion: https://postgr.es/m/20210627041138.zklczwmu3ms4ufnk@nol
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/d22646922d66012705e0e2948cfb5b4a07092a29
Modified Files
--------------
src/backend/utils/adt/ruleutils.c | 54 ++++++++++++++++++++++++++++++---------
src/include/utils/ruleutils.h | 1 +
2 files changed, 43 insertions(+), 12 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 2022-03-28 16:27:29 | Re: pgsql: Add 'basebackup_to_shell' contrib module. |
Previous Message | Alvaro Herrera | 2022-03-28 15:13:31 | pgsql: Fix role names in merge.sql regress file |