Re: Alias of VALUES RTE in explain plan - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Alias of VALUES RTE in explain plan
Date
Msg-id 1354173.1736203579@sss.pgh.pa.us
Whole thread Raw
In response to Re: Alias of VALUES RTE in explain plan  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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 by date:

Previous
From: Tom Lane
Date:
Subject: Re: allow changing autovacuum_max_workers without restarting
Next
From: Tom Lane
Date:
Subject: Re: allow changing autovacuum_max_workers without restarting