Re: Making the subquery alias optional in the FROM clause

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Making the subquery alias optional in the FROM clause
Дата
Msg-id 1988015.1657044045@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Making the subquery alias optional in the FROM clause  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Ответы Re: Making the subquery alias optional in the FROM clause  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Список pgsql-hackers
Dean Rasheed <dean.a.rasheed@gmail.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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Jacob Champion
Дата:
Сообщение: Re: generic plans and "initial" pruning
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: First draft of the PG 15 release notes