From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Making the subquery alias optional in the FROM clause |
Date: | 2022-07-05 18:00:45 |
Message-ID: | 1988015.1657044045@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> writes:
> This was discussed previously in [1], and there seemed to be general
> consensus in favour of it, but no new patch emerged.
As I said in that thread, I'm not super enthused about this, but I was
clearly in the minority so I think it should go forward.
> Attached is a patch that takes the approach of not generating an alias
> at all, which seems to be neater and simpler, and less code than
> trying to generate a unique alias.
Hm. Looking at the code surrounding what you touched, I'm reminded
that we allow JOIN nodes to not have an alias, and represent that
situation by rte->alias == NULL. I wonder if it'd be better in the
long run to make alias-less subqueries work similarly, rather than
generating something that after-the-fact will be indistinguishable
from a user-written alias. If that turns out to not work well,
I'd agree with "unnamed_subquery" as the inserted name.
Also, what about VALUES clauses? It seems inconsistent to remove
this restriction for sub-SELECT but not VALUES. Actually it looks
like your patch already does remove that restriction in gram.y,
but you didn't follow through elsewhere.
As far as the docs go, I think it's sufficient to mention the
inconsistency with SQL down at the bottom; we don't need a
redundant in-line explanation.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2022-07-05 18:09:44 | Re: First draft of the PG 15 release notes |
Previous Message | Jacob Champion | 2022-07-05 17:43:21 | Re: generic plans and "initial" pruning |