From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Andrei Lepikhov <lepihov(at)gmail(dot)com>, Yasir <yasir(dot)hussain(dot)shah(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Alias of VALUES RTE in explain plan |
Date: | 2025-01-06 22:46:19 |
Message-ID: | 1354173.1736203579@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
BTW, it suddenly strikes me that if anyone actually is using this
syntax in the field, they're most likely doing it like this:
regression=# create view v as
regression-# select * from (values (1),(2),(3) order by 1) v(x);
CREATE VIEW
which nicely sidesteps the question of what column aliases apply.
However, ruleutils.c unhelpfully regurgitates that as
regression=# \d+ v
View "public.v"
Column | Type | Collation | Nullable | Default | Storage | Description
--------+---------+-----------+----------+---------+---------+-------------
x | integer | | | | plain |
View definition:
SELECT x
FROM ( VALUES (1), (2), (3)
ORDER BY "*VALUES*".column1) v(x);
Maybe we could teach it that in this one case, using column numbers
is a better idea. It's not SQL-spec anymore (since SQL99 anyway).
But the SQL spec has noplace to hide here, because they don't say
what column names you could use in this misbegotten but
spec-sanctioned syntax.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Nathan Bossart | 2025-01-06 23:20:22 | Re: allow changing autovacuum_max_workers without restarting |
Previous Message | Tom Lane | 2025-01-06 22:36:17 | Re: allow changing autovacuum_max_workers without restarting |