Re: BUG #15352: postgresql FDW error "ERROR: ORDER BY position 0 is not in select list"

Поиск
Список
Период
Сортировка
От Andrew Gierth
Тема Re: BUG #15352: postgresql FDW error "ERROR: ORDER BY position 0 is not in select list"
Дата
Msg-id 87pnxyx6kf.fsf@news-spur.riddles.org.uk
обсуждение исходный текст
Ответ на Re: BUG #15352: postgresql FDW error "ERROR: ORDER BY position 0 isnot in select list"  (Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>)
Список pgsql-bugs
>>>>> "Ashutosh" == Ashutosh Bapat <ashutosh.bapat@enterprisedb.com> writes:

 Ashutosh> Looking at deparseSortGroupClause() this issue looks to be
 Ashutosh> fixed in HEAD. Either the version where bug was found doesn't
 Ashutosh> have this fix or somehow the fix isn't working.

You're misreading the code. The OP's example clearly demonstrates the
bug when tested with HEAD prior to bf2d0462c or with bf2d0462c reverted.

As the code stands, it _cannot_ use deparseSortGroupClause for
generating EXPLAINs for pathkeys that are chosen by postgres_fdw,
because deparseSortGroupClause wants a tlist, not a plain list of
expressions.

(Perhaps you haven't realized that without the additional check, when
remote estimates are enabled we end up sending EXPLAIN commands to the
remote for paths that cannot possibly be of any use in the query?
Round-trips to the remote are not free.)

 >> How do you think that could happen, given that redundant pathkeys
 >> are already removed?

 Ashutosh> I don't have exact answer.

Then you should find out.

 Ashutosh> But deparseSortGroupClause() has code to deparse constants in
 Ashutosh> GROUP BY indicates that we do encounter such pathkeys
 Ashutosh> somewhere.

GROUP BY isn't based on pathkeys (for one thing, grouping columns might
not be sortable).

 Ashutosh> I am thinking about ORDER BY being pushed down for GROUP BY.

Perhaps you should take a look at how the pathkeys for that case are
generated.

-- 
Andrew (irc:RhodiumToad)


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

Предыдущее
От: "Melek JARRAYA"
Дата:
Сообщение: Re: Not found indexed word
Следующее
От: jhm713
Дата:
Сообщение: Re: Inconsistencies restoring public schema ownership from pg_dump