From fc295bc4913921efc22f25954b69797184741774 Mon Sep 17 00:00:00 2001 From: 08ming <754041231@qq.com> Date: Fri, 28 Jun 2024 12:05:54 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3timescaledb=E6=8F=92=E4=BB=B6?= =?UTF-8?q?,=20=E6=99=AE=E9=80=9A=E8=A1=A8=E4=BF=AE=E6=94=B9=E5=88=97?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=B1=9E=E6=80=A7=E5=90=8E=E8=BD=AC=E5=8C=96?= =?UTF-8?q?=E4=B8=BA=E8=B6=85=E8=A1=A8=E6=8F=92=E5=85=A5=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gausskernel/optimizer/plan/setrefs.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gausskernel/optimizer/plan/setrefs.cpp b/src/gausskernel/optimizer/plan/setrefs.cpp index a88b0333a..ec5db1b95 100644 --- a/src/gausskernel/optimizer/plan/setrefs.cpp +++ b/src/gausskernel/optimizer/plan/setrefs.cpp @@ -120,7 +120,7 @@ static bool fix_scan_expr_walker(Node* node, fix_scan_expr_context* context); static void set_join_references(PlannerInfo* root, Join* join, int rtoffset); static void set_upper_references(PlannerInfo* root, Plan* plan, int rtoffset); static void set_dummy_tlist_references(Plan* plan, int rtoffset); -static indexed_tlist* build_tlist_index(List* tlist); +static indexed_tlist* build_tlist_index(List* tlist, bool returnConstForConst = false); static Var* search_indexed_tlist_for_var(Var* var, indexed_tlist* itlist, Index newvarno, int rtoffset); static Var* search_indexed_tlist_for_non_var(Node* node, indexed_tlist* itlist, Index newvarno); static Var* search_indexed_tlist_for_sortgroupref( @@ -1228,7 +1228,7 @@ static void set_tlist_qual_extensible_exprs_of_extensibleplan(PlannerInfo* root, { if (cscan->extensible_plan_tlist != NIL || cscan->scan.scanrelid == 0) { /* Adjust tlist, qual, extensible_exprs to reference extensible scan tuple */ - indexed_tlist* itlist = build_tlist_index(cscan->extensible_plan_tlist); + indexed_tlist* itlist = build_tlist_index(cscan->extensible_plan_tlist, true); cscan->scan.plan.targetlist = (List*)fix_upper_expr(root, (Node*)cscan->scan.plan.targetlist, itlist, INDEX_VAR, rtoffset); @@ -1771,7 +1771,7 @@ static void set_dummy_tlist_references(Plan* plan, int rtoffset) * to search_indexed_tlist_for_var() or search_indexed_tlist_for_non_var(). * When done, the indexed_tlist may be freed with a single pfree_ext(). */ -static indexed_tlist* build_tlist_index(List* tlist) +static indexed_tlist* build_tlist_index(List* tlist, bool returnConstForConst) { indexed_tlist* itlist = NULL; tlist_vinfo* vinfo = NULL; @@ -1799,6 +1799,8 @@ static indexed_tlist* build_tlist_index(List* tlist) vinfo++; } else if (tle->expr && IsA(tle->expr, PlaceHolderVar)) itlist->has_ph_vars = true; + else if (tle->expr && IsA(tle->expr, Const) && returnConstForConst) + itlist->return_const = true; else itlist->has_non_vars = true; }