Mention TABLEFUNC to make comment consistent with code
Hi hackers! This patch updates the comment flatten_join_alias_vars() that explains why it can be skipped when the expression to preprocess_expression() is of specific types, we now mention TABLEFUNC in the comment so that comment and code stay consistent.
Regards,
steve
Attachments:
v1-0001-Mention-TABLEFUNC-to-make-comment-consistent-with-co.patchapplication/octet-stream; name=v1-0001-Mention-TABLEFUNC-to-make-comment-consistent-with-co.patchDownload
From ade455e95ebc2300b5d7a76e8f6b2167406f69db Mon Sep 17 00:00:00 2001
From: Steve Lau <stevelauc@outlook.com>
Date: Thu, 27 Nov 2025 22:21:42 +0800
Subject: [PATCH v1] Mention TABLEFUNC to make comment consistent with code
Commit [1] that implemented the XMLTABLE table function didn't update
this comment, leaving code and comment inconsistent.
This commit updates the comment to make it consistent.
[1]: https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=fcec6caafa2346b6c9d3ad5065e417733bd63cd9
---
src/backend/optimizer/plan/planner.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index c4fd646b999..9f1404b9bad 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -1298,8 +1298,8 @@ preprocess_expression(PlannerInfo *root, Node *expr, int kind)
* we may extract from the joinaliasvars lists have not been preprocessed.
* For example, if we did this after sublink processing, sublinks expanded
* out from join aliases would not get processed. But we can skip this in
- * non-lateral RTE functions, VALUES lists, and TABLESAMPLE clauses, since
- * they can't contain any Vars of the current query level.
+ * non-lateral RTE functions, VALUES lists, TABLESAMPLE, and TABLEFUNC
+ * clauses, since they can't contain any Vars of the current query level.
*/
if (root->hasJoinRTEs &&
!(kind == EXPRKIND_RTFUNC ||
--
2.51.2
On Thu, Nov 27, 2025 at 10:44 PM Steve Lau <stevelauc@outlook.com> wrote:
Hi hackers! This patch updates the comment flatten_join_alias_vars() that explains why it can be skipped when the expression to preprocess_expression() is of specific types, we now mention TABLEFUNC in the comment so that comment and code stay consistent.
hi.
look at the json_table (TABLEFUNC) code, your comments change seems good.
in transformJsonTable, we have:
``
is_lateral = jt->lateral || contain_vars_of_level((Node *) tf, 0);
``
so overall, I am ok with the comments:
"""
But we can skip this in non-lateral RTE functions, VALUES lists,
TABLESAMPLE, and TABLEFUNC clauses, since they can't contain any Vars of the
current query level.
"""