From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
Cc: pgsql-bugs@lists.postgresql.org
Cc: rhaas@postgresql.org
Subject: Re: BUG #15352: postgresql FDW error "ERROR: ORDER BY position 0 is not in select list"
Date: Thu, 30 Aug 2018 09:44:34 +0100
Message-ID: <87efegxn6b.fsf@news-spur.riddles.org.uk> (raw)
In-Reply-To: <CAFjFpRdnbgGWxZZ4H3vxJMURvak+DgrkeamRh3ZYJe4X9mqpLw@mail.gmail.com>
References: <153518420278.1478.14875560810251994661@wrigleys.postgresql.org>
<87efemzw0v.fsf@news-spur.riddles.org.uk>
<87a7paz8b1.fsf@news-spur.riddles.org.uk>
<87r2iiy3if.fsf@news-spur.riddles.org.uk>
<CAFjFpRcShdm5V_9Je4CzaRw31QhDW4s6VKzZ2m50JvKANL4jjw@mail.gmail.com>
<87mut5xye8.fsf@news-spur.riddles.org.uk>
<CAFjFpRdnbgGWxZZ4H3vxJMURvak+DgrkeamRh3ZYJe4X9mqpLw@mail.gmail.com>
[removing the OP from CC list]
>>>>> "Ashutosh" == Ashutosh Bapat <ashutosh.bapat@enterprisedb.com> writes:
>> Well, it's certainly pointless.
>>
>> But the failure in this case is specifically about pushing down an
>> _integer_ constant, because the deparse code for pushing down an
>> ORDER BY does not understand that integer literals in ORDER BY
>> clauses are a special case.
Ashutosh> Deparser needs to be fixed then, irrespective of whether or
Ashutosh> not we fix the costant pathkey problem.
Since we have no business sending sort expressions to the remote that do
not include remote vars, this seems superfluous. Any such expression is
either mutable (and hence not pushable anyway) or known locally to be
constant (in which case we never legitimately see it in a pathkey).
(Maybe Asserting it or throwing an error might be appropriate.)
>> I'm pretty sure that constant (hence redundant) clauses have been
>> removed from pathkeys before postgres_fdw will see them. The problem
>> only occurs because postgres_fdw tries inventing _new_ pathkeys for
>> possible orderings from eclasses (in order to try for mergejoin
>> opportunities) in addition to using the requested pathkeys, and it's
>> clearly pointless to do that with constants.
Ashutosh> Yes, I forgot about that. But even in that case, we should
Ashutosh> consider the case when the constant pathkey is just one in
Ashutosh> the bunch and we are trying to push the whole bunch.
How do you think that could happen, given that redundant pathkeys are
already removed?
--
Andrew (irc:RhodiumToad)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: andrew@tao11.riddles.org.uk, ashutosh.bapat@enterprisedb.com, rhaas@postgresql.org
Subject: Re: BUG #15352: postgresql FDW error "ERROR: ORDER BY position 0 is not in select list"
In-Reply-To: <87efegxn6b.fsf@news-spur.riddles.org.uk>
References: <153518420278.1478.14875560810251994661@wrigleys.postgresql.org> <87efemzw0v.fsf@news-spur.riddles.org.uk> <87a7paz8b1.fsf@news-spur.riddles.org.uk> <87r2iiy3if.fsf@news-spur.riddles.org.uk> <CAFjFpRcShdm5V_9Je4CzaRw31QhDW4s6VKzZ2m50JvKANL4jjw@mail.gmail.com> <87mut5xye8.fsf@news-spur.riddles.org.uk> <CAFjFpRdnbgGWxZZ4H3vxJMURvak+DgrkeamRh3ZYJe4X9mqpLw@mail.gmail.com> <87efegxn6b.fsf@news-spur.riddles.org.uk>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox