Re: [HACKERS] Issue with NULLS LAST, with postgres_fdw sort pushdown

2016-03-04 Thread Robert Haas
On Thu, Mar 3, 2016 at 12:08 AM, Tom Lane wrote: > Ashutosh Bapat writes: >> On Thu, Mar 3, 2016 at 7:27 AM, Michael Paquier >> wrote: >>> Per explain.c, this looks inconsistent to me. Shouldn't NULLS LAST be >>> applied only if DESC is used in this ORDER BY clause? > >> ... In this case we are

Re: [HACKERS] Issue with NULLS LAST, with postgres_fdw sort pushdown

2016-03-02 Thread Tom Lane
Ashutosh Bapat writes: > On Thu, Mar 3, 2016 at 7:27 AM, Michael Paquier > wrote: >> Per explain.c, this looks inconsistent to me. Shouldn't NULLS LAST be >> applied only if DESC is used in this ORDER BY clause? > ... In this case we are constructing a query to be > sent to the foreign server an

Re: [HACKERS] Issue with NULLS LAST, with postgres_fdw sort pushdown

2016-03-02 Thread Ashutosh Bapat
On Thu, Mar 3, 2016 at 7:27 AM, Michael Paquier wrote: > On Wed, Mar 2, 2016 at 7:04 PM, Rajkumar Raghuwanshi > wrote: > > On Wed, Mar 2, 2016 at 2:35 PM, Ashutosh Bapat > > wrote: > >> > >> Thanks Rajkumar for your report. Let me know if the attached patch fixes > >> the issue. > > if

Re: [HACKERS] Issue with NULLS LAST, with postgres_fdw sort pushdown

2016-03-02 Thread Michael Paquier
On Wed, Mar 2, 2016 at 7:04 PM, Rajkumar Raghuwanshi wrote: > On Wed, Mar 2, 2016 at 2:35 PM, Ashutosh Bapat > wrote: >> >> Thanks Rajkumar for your report. Let me know if the attached patch fixes >> the issue. if (pathkey->pk_nulls_first) appendStringInfoString(buf, " NULL

Re: [HACKERS] Issue with NULLS LAST, with postgres_fdw sort pushdown

2016-03-02 Thread Rajkumar Raghuwanshi
Thanks Ashutosh. Retested the issue after applying given patch,It is fine now. Thanks & Regards, Rajkumar Raghuwanshi QMG, EnterpriseDB Corporation On Wed, Mar 2, 2016 at 2:35 PM, Ashutosh Bapat < ashutosh.ba...@enterprisedb.com> wrote: > Thanks Rajkumar for your report. Let me know if the attac

Re: [HACKERS] Issue with NULLS LAST, with postgres_fdw sort pushdown

2016-03-02 Thread Ashutosh Bapat
Thanks Rajkumar for your report. Let me know if the attached patch fixes the issue. The code did not add NULL LAST clause the case when pk_nulls_first is false in pathkey. PFA the fix for the same. I have also added few tests to postgres_fdw.sql for few combinations of asc/desc and nulls first/las

[HACKERS] Issue with NULLS LAST, with postgres_fdw sort pushdown

2016-02-29 Thread Rajkumar Raghuwanshi
Hi, I am testing postgres_fdw sort pushdown feature for PostgreSQL 9.6 DB, and I observed below issue. *Observation: *If giving nulls last option with the order by clause as 'desc nulls last', remote query is not considering nulls last and giving wrong result in 9.6 version. while in 9.5 it is gi