Re: Issue with NULLS LAST, with postgres_fdw sort pushdown

Поиск
Список
Период
Сортировка
От Ashutosh Bapat
Тема Re: Issue with NULLS LAST, with postgres_fdw sort pushdown
Дата
Msg-id CAFjFpReOMXWFEcbG1WYzJOXdVO3U6Puo-=NhBBg2DS7X3XY8SQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Issue with NULLS LAST, with postgres_fdw sort pushdown  (Michael Paquier <michael.paquier@gmail.com>)
Ответы Re: Issue with NULLS LAST, with postgres_fdw sort pushdown  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers


On Thu, Mar 3, 2016 at 7:27 AM, Michael Paquier <michael.paquier@gmail.com> wrote:
On Wed, Mar 2, 2016 at 7:04 PM, Rajkumar Raghuwanshi
<rajkumar.raghuwanshi@enterprisedb.com> wrote:
> On Wed, Mar 2, 2016 at 2:35 PM, Ashutosh Bapat
> <ashutosh.bapat@enterprisedb.com> wrote:
>>
>> Thanks Rajkumar for your report. Let me know if the attached patch fixes
>> the issue.

         if (pathkey->pk_nulls_first)
             appendStringInfoString(buf, " NULLS FIRST");
+        else
+            appendStringInfoString(buf, " NULLS LAST");
Per explain.c, this looks inconsistent to me. Shouldn't NULLS LAST be
applied only if DESC is used in this ORDER BY clause?


I assume that you are referring to show_sortorder_options().

As per PG documentation http://www.postgresql.org/docs/9.4/static/queries-order.html, "By default, null values sort as if larger than any non-null value; that is, NULLS FIRST is the default for DESC order, and NULLS LAST otherwise." What show_sortorder_options() is doing is just trying to avoid printing the defaults, which is arguably fine for an explain output; it leaves defaults to be interpreted by user. In this case we are constructing a query to be sent to the foreign server and it's better not to leave the defaults to be interpreted by the foreign server; in case it interprets them in different fashion. get_rule_orderby() also explicitly adds these options.

--
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: extend pgbench expressions with functions
Следующее
От: Tom Lane
Дата:
Сообщение: Re: WIP: Upper planner pathification