Postgres_fdw join pushdown - INNER - FULL OUTER join combination generating wrong result

From: Rajkumar Raghuwanshi <rajkumar(dot)raghuwanshi(at)enterprisedb(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Postgres_fdw join pushdown - INNER - FULL OUTER join combination generating wrong result
Date: 2016-03-28 09:17:02
Message-ID: CAKcux6nyKFXUkb3B-C-yW_tfdH5wqFc9e=G1G_bidrudE+EL3w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I am testing postgres_fdw join pushdown feature for PostgreSQL 9.6 DB, and
I observed below issue.

*Observation:* Inner join and full outer join combination on a table
generating wrong result.

SELECT * FROM lt;
c1
----
1
2
(2 rows)

SELECT * FROM ft;
c1
----
1
2
(2 rows)

\d+ ft
Foreign table "public.ft"
Column | Type | Modifiers | FDW Options | Storage | Stats target |
Description
--------+---------+-----------+-------------+---------+--------------+-------------
c1 | integer | | | plain | |
Server: link_server
FDW Options: (table_name 'lt')

--inner join and full outer join on local tables
SELECT t1.c1,t2.c1,t3.c1 FROM lt t1 INNER JOIN lt t2 ON (t1.c1 = t2.c1)
FULL JOIN lt t3 ON (t2.c1 = t3.c1);
c1 | c1 | c1
----+----+----
1 | 1 | 1
2 | 2 | 2
(2 rows)

--inner join and full outer join on corresponding foreign tables
SELECT t1.c1,t2.c1,t3.c1 FROM ft t1 INNER JOIN ft t2 ON (t1.c1 = t2.c1)
FULL JOIN ft t3 ON (t2.c1 = t3.c1);
c1 | c1 | c1
----+----+----
1 | 1 | 1
1 | 2 |
2 | 1 |
2 | 2 | 2
(4 rows)

Thanks & Regards,
Rajkumar Raghuwanshi
QMG, EnterpriseDB Corporation

>

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2016-03-28 09:25:47 Re: Support for N synchronous standby servers - take 2
Previous Message Alexander Korotkov 2016-03-28 09:13:21 Re: [PATCH] Phrase search ported to 9.6