Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcba5c70

Browse files
committed
Fix setrefs.c code for Result Cache nodes
Result Cache, added in9eacee2 neglected to properly adjust the planreferences in setrefs.c. This could lead to the following error duringEXPLAIN:ERROR: cannot decompile join alias var in plan treeFix that.Bug: 17030Reported-by: Hans BuschmannDiscussion:https://postgr.es/m/17030-5844aecae42fe223@postgresql.org
1 parentc242baa commitcba5c70

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

‎src/backend/optimizer/plan/setrefs.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,12 @@ set_plan_refs(PlannerInfo *root, Plan *plan, int rtoffset)
756756
{
757757
ResultCache*rcplan= (ResultCache*)plan;
758758

759+
/*
760+
* Result Cache does not evaluate its targetlist. It just
761+
* uses the same targetlist from its outer subnode.
762+
*/
763+
set_dummy_tlist_references(plan,rtoffset);
764+
759765
rcplan->param_exprs=fix_scan_list(root,rcplan->param_exprs,
760766
rtoffset,
761767
NUM_EXEC_TLIST(plan));

‎src/test/regress/expected/join.out

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4216,8 +4216,8 @@ where t1.f1 = ss.f1;
42164216
QUERY PLAN
42174217
--------------------------------------------------
42184218
Nested Loop
4219-
Output: t1.f1, i8.q1, i8.q2,q1,f1
4220-
Join Filter: (t1.f1 = f1)
4219+
Output: t1.f1, i8.q1, i8.q2,(i8.q1), t2.f1
4220+
Join Filter: (t1.f1 =t2.f1)
42214221
-> Nested Loop Left Join
42224222
Output: t1.f1, i8.q1, i8.q2
42234223
-> Seq Scan on public.text_tbl t1
@@ -4228,7 +4228,7 @@ where t1.f1 = ss.f1;
42284228
Output: i8.q1, i8.q2
42294229
Filter: (i8.q2 = 123)
42304230
-> Result Cache
4231-
Output:q1,f1
4231+
Output:(i8.q1), t2.f1
42324232
Cache Key: i8.q1
42334233
-> Limit
42344234
Output: (i8.q1), t2.f1
@@ -4255,13 +4255,13 @@ select * from
42554255
lateral (select i8.q1, t2.f1 from text_tbl t2 limit 1) as ss1,
42564256
lateral (select ss1.* from text_tbl t3 limit 1) as ss2
42574257
where t1.f1 = ss2.f1;
4258-
QUERY PLAN
4259-
--------------------------------------------------------
4258+
QUERY PLAN
4259+
-------------------------------------------------------------------
42604260
Nested Loop
4261-
Output: t1.f1, i8.q1, i8.q2,q1,f1,q1, f1
4262-
Join Filter: (t1.f1 =f1)
4261+
Output: t1.f1, i8.q1, i8.q2,(i8.q1), t2.f1,((i8.q1)), (t2.f1)
4262+
Join Filter: (t1.f1 =(t2.f1))
42634263
-> Nested Loop
4264-
Output: t1.f1, i8.q1, i8.q2,q1,f1
4264+
Output: t1.f1, i8.q1, i8.q2,(i8.q1), t2.f1
42654265
-> Nested Loop Left Join
42664266
Output: t1.f1, i8.q1, i8.q2
42674267
-> Seq Scan on public.text_tbl t1
@@ -4272,19 +4272,19 @@ where t1.f1 = ss2.f1;
42724272
Output: i8.q1, i8.q2
42734273
Filter: (i8.q2 = 123)
42744274
-> Result Cache
4275-
Output:q1,f1
4275+
Output:(i8.q1), t2.f1
42764276
Cache Key: i8.q1
42774277
-> Limit
42784278
Output: (i8.q1), t2.f1
42794279
-> Seq Scan on public.text_tbl t2
42804280
Output: i8.q1, t2.f1
42814281
-> Result Cache
4282-
Output:q1, f1
4283-
Cache Key:q1,f1
4282+
Output:((i8.q1)), (t2.f1)
4283+
Cache Key:(i8.q1), t2.f1
42844284
-> Limit
4285-
Output: (q1), (f1)
4285+
Output: ((i8.q1)), (t2.f1)
42864286
-> Seq Scan on public.text_tbl t3
4287-
Output:q1,f1
4287+
Output:(i8.q1), t2.f1
42884288
(28 rows)
42894289

42904290
select * from

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp