| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Fix incorrect printing of queries with duplicated join names. |
| Date: | 2019-06-12 23:43:28 |
| Message-ID: | [email protected] |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Fix incorrect printing of queries with duplicated join names.
Given a query in which multiple JOIN nodes used the same alias
(which'd necessarily be in different sub-SELECTs), ruleutils.c
would assign the JOIN nodes distinct aliases for clarity ...
but then it forgot to print the modified aliases when dumping
the JOIN nodes themselves. This results in a dump/reload hazard
for views, because the emitted query is flat-out incorrect:
Vars will be printed with table names that have no referent.
This has been wrong for a long time, so back-patch to all supported
branches.
Philip Dubé
Discussion: https://postgr.es/m/CY4PR2101MB080246F2955FF58A6ED1FEAC98140@CY4PR2101MB0802.namprd21.prod.outlook.com
Branch
------
REL_10_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/30d3df0a7b823d14c8bf43d949a122492b5d039c
Modified Files
--------------
src/backend/utils/adt/ruleutils.c | 10 ++++++++-
src/test/regress/expected/create_view.out | 37 ++++++++++++++++++++++++++++++-
src/test/regress/sql/create_view.sql | 9 ++++++++
3 files changed, 54 insertions(+), 2 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 2019-06-13 02:48:08 | pgsql: docs: PG 12 relnotes, update btree items |
| Previous Message | David Rowley | 2019-06-12 22:35:54 | pgsql: doc: Fix grammatical error in partitioning docs |