postgres_fdw - IS TRUE/FALSE conditions are not pushed down

From: Sergiy Zuban <s(dot)zuban(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: postgres_fdw - IS TRUE/FALSE conditions are not pushed down
Date: 2014-07-18 18:38:56
Message-ID: CAGz8fGabvwUehJ8ssiFRFPmT80ymXToChhTzHbWpmfXq86DmNQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

I've setup foreign table and noticed inconsistency how conditionals handled
for boolean columns.

explain verbose select * from temporary_testing.t_proxied where active is
true;
QUERY PLAN
------------------------------------------------------------
--------------------------
Foreign Scan on temporary_testing.t_proxied (cost=100.00..194.72
rows=1412 width=5)
Output: id, active
Filter: (t_proxied.active IS TRUE)
Remote SQL: SELECT id, active FROM main_testing.t_url

But, when = used instead of IS it works correctly. All conditions below
(including IS NULL) are pushed down to remote server:

explain verbose select * from temporary_testing.t_proxied where active;
explain verbose select * from temporary_testing.t_proxied where
NOT(active);
explain verbose select * from temporary_testing.t_proxied where active =
false;
explain verbose select * from temporary_testing.t_proxied where active =
true;

------------------------------------------------------------
--------------------------
Foreign Scan on temporary_testing.t_proxied (cost=100.00..166.48
rows=1412 width=5)
Output: id, active
Remote SQL: SELECT id, active FROM main_testing.t_url WHERE (active)

explain verbose select * from temporary_testing.t_proxied where active is
null;
QUERY PLAN
------------------------------------------------------------
------------------------
Foreign Scan on temporary_testing.t_proxied (cost=100.00..138.52 rows=14
width=5)
Output: id, active
Remote SQL: SELECT id, active FROM main_testing.t_url WHERE ((active IS
NULL))

DO I need to report this as bug?

Tested on PostgreSQL 9.3.4
--
Sergiy Zuban

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sergiy Zuban 2014-07-18 18:57:07 postgres_fdw - push down conditionals for ENUMs
Previous Message David G Johnston 2014-07-18 17:41:30 Re: Petition: Treat #!... shebangs as comments