You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Get rid of duplicate child RTE for a partitioned table.
We've been creating duplicate RTEs for partitioned tables justbecause we do so for regular inheritance parent tables. But unlikeregular-inheritance parents which are themselves regular tablesand thus need to be scanned, partitioned tables don't need theextra RTE.This makes the conditions for building a child RTE the same as thosefor building an AppendRelInfo, allowing minor simplification inexpand_single_inheritance_child. Since the planner's actual processingis driven off the AppendRelInfo list, nothing much changes beyond that,we just have one fewer useless RTE entry.Amit Langote, reviewed and hacked a bit by meDiscussion:https://postgr.es/m/9d7c5112-cb99-6a47-d3be-cf1ee6862a1d@lab.ntt.co.jp
Copy file name to clipboardExpand all lines: contrib/postgres_fdw/expected/postgres_fdw.out
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -8435,7 +8435,7 @@ SELECT t1.a,t2.b,t2.c FROM fprt1 t1 LEFT JOIN (SELECT * FROM fprt2 WHERE a < 10)
8435
8435
Foreign Scan
8436
8436
Output: t1.a, ftprt2_p1.b, ftprt2_p1.c
8437
8437
Relations: (public.ftprt1_p1 t1) LEFT JOIN (public.ftprt2_p1 fprt2)
8438
-
Remote SQL: SELECTr6.a,r9.b,r9.c FROM (public.fprt1_p1r6 LEFT JOIN public.fprt2_p1r9 ON (((r6.a =r9.b)) AND ((r6.b =r9.a)) AND ((r9.a < 10)))) WHERE ((r6.a < 10)) ORDER BYr6.a ASC NULLS LAST,r9.b ASC NULLS LAST,r9.c ASC NULLS LAST
8438
+
Remote SQL: SELECTr5.a,r7.b,r7.c FROM (public.fprt1_p1r5 LEFT JOIN public.fprt2_p1r7 ON (((r5.a =r7.b)) AND ((r5.b =r7.a)) AND ((r7.a < 10)))) WHERE ((r5.a < 10)) ORDER BYr5.a ASC NULLS LAST,r7.b ASC NULLS LAST,r7.c ASC NULLS LAST
8439
8439
(4 rows)
8440
8440
8441
8441
SELECT t1.a,t2.b,t2.c FROM fprt1 t1 LEFT JOIN (SELECT * FROM fprt2 WHERE a < 10) t2 ON (t1.a = t2.b and t1.b = t2.a) WHERE t1.a < 10 ORDER BY 1,2,3;