Re: Alias of VALUES RTE in explain plan

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Alias of VALUES RTE in explain plan
Дата
Msg-id 251197.1730222362@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Alias of VALUES RTE in explain plan  (Andrei Lepikhov <lepihov@gmail.com>)
Ответы Re: Alias of VALUES RTE in explain plan
Re: Alias of VALUES RTE in explain plan
Список pgsql-hackers
Andrei Lepikhov <lepihov@gmail.com> writes:
> -- New behavior
> EXPLAIN (COSTS OFF, VERBOSE)
> SELECT * FROM (VALUES (4),(2),(3),(1) ORDER BY t1.x LIMIT 2) AS t1(x);
> SELECT * FROM (VALUES (4),(2),(3),(1) ORDER BY t1.x LIMIT 2) AS t1(x);

After taking a closer look at that, yeah it's new behavior, and
I'm not sure we want to change it.  (The existing behavior is that
you'd have to write 'column1' or '"*VALUES*".column1' in the
subquery's ORDER BY.)

This example also violates my argument that the user thinks they
are attaching the alias directly to VALUES.  So what I now think
is that we ought to tweak the patch so that the parent alias is
pushed down only when the subquery contains just VALUES, no other
clauses.  Per a look at the grammar, ORDER BY, LIMIT, and FOR
UPDATE could conceivably appear alongside VALUES; although
FOR UPDATE would draw "FOR UPDATE cannot be applied to VALUES",
so maybe we needn't worry about it.

Thoughts?

            regards, tom lane



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