From: Tom Lane <tgl@sss.pgh.pa.us>
To: Rhys A.D. Stewart <rhys.stewart@gmail.com>
Cc: pgsql-general@postgresql.org
Subject: Re: postgres_fdw pushdown problem.
Date: Tue, 20 Nov 2018 13:23:47 -0500
Message-ID: <26365.1542738227@sss.pgh.pa.us> (raw)
In-Reply-To: <CACg0vT=zdWuSLmfwFCjarKXVZumwymYrO8nzQZ9X1j5nB8VZzg@mail.gmail.com>
References: <CACg0vT=zdWuSLmfwFCjarKXVZumwymYrO8nzQZ9X1j5nB8VZzg@mail.gmail.com>
"Rhys A.D. Stewart" <rhys.stewart@gmail.com> writes:
> I'm using postgres_fdw and am having a pushdown issue. The TL;DR is
> that the where clause doesn't get pushed down for the last of the
> following three queries.
> SELECT * FROM service.mrrdr_synth WHERE premises = '1057430';
> SELECT * FROM service.mrrdr_synth WHERE reading_val = '8';
> SELECT * FROM service.mrrdr_synth WHERE location_capture_time =
> '2018-10-20 12:02:53.097247-05'::timestamptz;
Well, you've got
> CREATE FOREIGN TABLE service.mrrdr_synth( ...
> location_capture_time timestamp without time zone NULL,
so that WHERE clause is a comparison of timestamp vs timestamptz,
which depends on the active timezone setting, so it's not immutable
and won't get pushed. (In English: the planner is afraid the remote
end might be using a different timezone setting.) I'm pretty sure
either timestamp = timestamp or timestamptz = timestamptz would be
pushable.
regards, tom lane
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-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, rhys.stewart@gmail.com
Subject: Re: postgres_fdw pushdown problem.
In-Reply-To: <26365.1542738227@sss.pgh.pa.us>
References: <CACg0vT=zdWuSLmfwFCjarKXVZumwymYrO8nzQZ9X1j5nB8VZzg@mail.gmail.com> <26365.1542738227@sss.pgh.pa.us>
* 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