-
Notifications
You must be signed in to change notification settings - Fork 2
Comparing changes
Open a pull request
base repository: postgresql-cfbot/postgresql
base: cf/5128~1
head repository: postgresql-cfbot/postgresql
compare: cf/5128
- 7 commits
- 19 files changed
- 3 contributors
Commits on Feb 1, 2025
-
Allow partition-wise join when reltarget contains whole row vars
This partially revert 7cfdc77, restoring setrefs logic to handle converted whole row reference.
Alexander Pyhalov authored and Commitfest Bot committedFeb 1, 2025 Configuration menu - View commit details
-
Copy full SHA for a9a174c - Browse repository at this point
Copy the full SHA a9a174cView commit details -
Handle ConvertRowtypeExprs in pull_vars_clause().
This is a preparatory patch to fix the unresolved ConvertRowtypeExpr references in the targetlists. The patch allows pull_vars_clause() to return ConvertRowtypeExprs without recursing into those. Because of the recent work to support indexes and triggers on partitioned table, every caller of pull_var_clause() can encounter a ConvertRowtype embedding a whole-row reference. Current behavior is unchanged. Callers which don't need to recurse to ConvertRowtypeExprs should explicitly pass PVC_INCLUDE_CONVERTROWTYPES. The patch is taken from https://www.postgresql.org/message-id/CAFjFpRc8ZoDm0%2Bzhx%2BMckwGyEqkOzWcpVqbvjaxwdGarZSNrmA%40mail.gmail.com
Configuration menu - View commit details
-
Copy full SHA for fa400cc - Browse repository at this point
Copy the full SHA fa400ccView commit details -
Configuration menu - View commit details
-
Copy full SHA for 80f0e3b - Browse repository at this point
Copy the full SHA 80f0e3bView commit details -
Compare converted whole row vars in search_indexed_tlist_for_non_var(…
…) correctly and fix test results
Alexander Pyhalov authored and Commitfest Bot committedFeb 1, 2025 Configuration menu - View commit details
-
Copy full SHA for ab48128 - Browse repository at this point
Copy the full SHA ab48128View commit details -
postgres_fdw: child-join with ConvertRowtypeExprs causes expression r…
…eference errors. Whole row reference of the parent is translated into ConvertRowtypeExpr with whole row of child as an argument. When partition-wise join is used, targetlist of a child-join contains ConvertRowtypeExpr/s when the parent-join's targetlist has whole-row reference/s of joining partitioned tables. The targetlist to be deparsed for a child-join is built using build_tlist_to_deparse(). The same targetlist is then saved as fdw_scan_tlist in ForeignScanPlan. build_tlist_to_deparse() pulls only Var nodes from the join's targetlist. So it pulls Var reprensenting a whole-row reference of a child from a ConvertRowtypeExpr. Thus the child-join's projected target list contains ConvertRowtypeExpr but the SELECT clause and fdw_scan_tlist contains a whole-row reference. This causes two problems: 1. When a relation (participating in the child-join being pushed down) is deparsed as a subquery, subquery's targetlist (and SELECT clause) contains expressions from foreignrel->reltarget->exprs. A Var from such a relation is deparsed as column reference of subquery using get_relation_column_alias_ids(). That function uses foreignrel's targetlist to locate given node to be deparsed. If the joining relation corresponding to ConvertRowtypeExpr is deparsed as a subquery, this function is called with whole-row reference node (Var node with varattno = 0). The relation's foreignrel->reltarget->exprs doesn't contain its whole-row reference directly but has it embedded in ConvertRowtypeExpr. So, the function doesn't find the given node and throws error. 2. When there is possibility of EvalPlanQual being called, we construct local join plan matching the pushed down foreign join. In postgresGetForeignPlan() after we have built the local join plan, the topmost plan node's targetlist is changed to fdw_scan_tlist to match the output of the ForeignScan node. As explained above, this fdw_scan_tlist contains a bare reference to the whole-row reference from a child relation if the child-join's targetlist contains a ConvertRowtypeExpr. When changing the topmost plan node's targetlist, we do not modify the targetlists of its left and right tree nodes. The left/right plan involving corresponding child relation will have ConvertRowtypeExpr expression in its targetlist, but not whole-row reference directly. When the topmost local join plan node's targetlist is processed by set_plan_ref(), it throws error "variable not found in subplan target lists" since it doesn't find bare whole-row reference of the child relation in subplan's targetlists. Solution This requires two parts a. In build_tlist_to_deparse(), instead of pulling Var node from ConvertRowtypeExpr, we pull whole ConvertRowtypeExpr and include it in the targetlist being deparsed which is also used to set fdw_scan_tlist. b. deparse ConvertRowtypeExpr. For this we need to get the conversion map between the parent and child. We then deparse ConvertRowtypeExpr as a ROW() with the attributes of child rearranged per the conversion map. A multi-level partitioned table will have nested ConvertRowtypeExpr. To deparse such expressions, we need to find the conversion map between the topmost parent and the child, by ignoring any intermediate parents. The patch is taken from https://www.postgresql.org/message-id/CAFjFpRc8ZoDm0%2Bzhx%2BMckwGyEqkOzWcpVqbvjaxwdGarZSNrmA%40mail.gmail.com
Configuration menu - View commit details
-
Copy full SHA for 52ab882 - Browse repository at this point
Copy the full SHA 52ab882View commit details -
postgres_fdw: fix partition-wise DML
Alexander Pyhalov authored and Commitfest Bot committedFeb 1, 2025 Configuration menu - View commit details
-
Copy full SHA for 4b565fe - Browse repository at this point
Copy the full SHA 4b565feView commit details -
[CF 51/5128] Allow partition-wise join when whole row var is needed
This commit was automatically generated by a robot at cfbot.cputube.org. It is based on patches submitted to the PostgreSQL mailing lists and registered in the PostgreSQL Commitfest application. This branch will be overwritten each time a new patch version is posted to the email thread, and also periodically to check for bitrot caused by changes on the master branch. Commitfest entry: https://commitfest.postgresql.org/51/5128 Patch(es): https://www.postgresql.org/message-id/[email protected] Author(s): Ashutosh Bapat, Alexander Pyhalov
Commitfest Bot committedFeb 1, 2025 Configuration menu - View commit details
-
Copy full SHA for 3e641ab - Browse repository at this point
Copy the full SHA 3e641abView commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff cf/5128~1...cf/5128