pgsql: Fix mishandling of system columns in FDW queries.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix mishandling of system columns in FDW queries.
Date: 2014-11-22 21:01:40
Message-ID: E1XsHoK-0006lS-Bn@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix mishandling of system columns in FDW queries.

postgres_fdw would send query conditions involving system columns to the
remote server, even though it makes no effort to ensure that system
columns other than CTID match what the remote side thinks. tableoid,
in particular, probably won't match and might have some use in queries.
Hence, prevent sending conditions that include non-CTID system columns.

Also, create_foreignscan_plan neglected to check local restriction
conditions while determining whether to set fsSystemCol for a foreign
scan plan node. This again would bollix the results for queries that
test a foreign table's tableoid.

Back-patch the first fix to 9.3 where postgres_fdw was introduced.
Back-patch the second to 9.2. The code is probably broken in 9.1 as
well, but the patch doesn't apply cleanly there; given the weak state
of support for FDWs in 9.1, it doesn't seem worth fixing.

Etsuro Fujita, reviewed by Ashutosh Bapat, and somewhat modified by me

Branch
------
REL9_2_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/906599f65f4353cd616d56171930457b86ddf709

Modified Files
--------------
src/backend/optimizer/plan/createplan.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2014-11-23 00:12:44 pgsql: Allow simplification of EXISTS() subqueries containing LIMIT.
Previous Message Andrew Dunstan 2014-11-22 14:45:32 pgsql: Rework echo_hidden for \sf and \ef from commit e4d2817.