Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gPAiq-0006EX-J9 for pgsql-general@arkaria.postgresql.org; Tue, 20 Nov 2018 18:26:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gPAgh-0002Ru-Gb for pgsql-general@arkaria.postgresql.org; Tue, 20 Nov 2018 18:23:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gPAgh-0002Rm-4T for pgsql-general@lists.postgresql.org; Tue, 20 Nov 2018 18:23:51 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gPAge-000218-NQ for pgsql-general@postgresql.org; Tue, 20 Nov 2018 18:23:49 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id wAKINlR9026366; Tue, 20 Nov 2018 13:23:47 -0500 From: Tom Lane To: "Rhys A.D. Stewart" cc: pgsql-general@postgresql.org Subject: Re: postgres_fdw pushdown problem. In-reply-to: References: Comments: In-reply-to "Rhys A.D. Stewart" message dated "Tue, 20 Nov 2018 13:03:32 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <26364.1542738227.1@sss.pgh.pa.us> Date: Tue, 20 Nov 2018 13:23:47 -0500 Message-ID: <26365.1542738227@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk "Rhys A.D. Stewart" 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