Re: Alias of VALUES RTE in explain plan
| От | Tom Lane |
|---|---|
| Тема | Re: Alias of VALUES RTE in explain plan |
| Дата | |
| Msg-id | 1354173.1736203579@sss.pgh.pa.us обсуждение |
| Ответ на | Re: Alias of VALUES RTE in explain plan (Tom Lane <tgl@sss.pgh.pa.us>) |
| Список | 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
В списке pgsql-hackers по дате отправления: