Em ter., 14 de set. de 2021 às 08:49, Rajkumar Raghuwanshi <
rajkumar.raghuwan...@enterprisedb.com> escreveu:

> Hi,
>
> I am getting "ERROR:  subplan "SubPlan 1" was not initialized" error with
> below test case.
>
> CREATE TABLE tbl ( c1 int, c2 int, c3 int ) PARTITION BY LIST (c1);
> create table tbl_null PARTITION OF tbl FOR VALUES IN (null);
> create table tbl_def PARTITION OF tbl DEFAULT;
> insert into tbl values (8800,0,0);
> insert into tbl values (1891,1,1);
> insert into tbl values (3420,2,0);
> insert into tbl values (9850,3,0);
> insert into tbl values (7164,4,4);
> analyze tbl;
> explain (costs off) select count(*) from tbl t1 where (exists(select 1
> from tbl t2 where t2.c1 = t1.c2) or c3 < 0);
>
> postgres=# explain (costs off) select count(*) from tbl t1 where
> (exists(select 1 from tbl t2 where t2.c1 = t1.c2) or c3 < 0);
> ERROR:  subplan "SubPlan 1" was not initialized
>
Not sure if that helps, but below backtrace at Windows 64.

00 postgres!ExecInitSubPlan(struct SubPlan * subplan = 0x00000000`021b4ed8,
struct PlanState * parent = 0x00000000`0219ff90)+0x93
[C:\dll\postgres\postgres_head\src\backend\executor\nodeSubplan.c @ 804]
01 postgres!ExecInitExprRec(struct Expr * node = 0x00000000`021b4ed8,
struct ExprState * state = 0x00000000`021a0ba0, unsigned int64 * resv =
0x00000000`021a0ba8, bool * resnull = 0x00000000`021a0ba5)+0x1447
[C:\dll\postgres\postgres_head\src\backend\executor\execExpr.c @ 1424]
02 postgres!ExecInitExprRec(struct Expr * node = 0x00000000`021b4ea8,
struct ExprState * state = 0x00000000`021a0ba0, unsigned int64 * resv =
0x00000000`021a0ba8, bool * resnull = 0x00000000`021a0ba5)+0x1176
[C:\dll\postgres\postgres_head\src\backend\executor\execExpr.c @ 1364]
03 postgres!ExecInitQual(struct List * qual = 0x00000000`021b5198, struct
PlanState * parent = 0x00000000`0219ff90)+0x197
[C:\dll\postgres\postgres_head\src\backend\executor\execExpr.c @ 256]
04 postgres!ExecInitSeqScan(struct SeqScan * node = 0x00000000`021b3dd8,
struct EState * estate = 0x00000000`0219f2c8, int eflags = 0n17)+0x105
[C:\dll\postgres\postgres_head\src\backend\executor\nodeSeqscan.c @ 171]
05 postgres!ExecInitNode(struct Plan * node = 0x00000000`021b3dd8, struct
EState * estate = 0x00000000`0219f2c8, int eflags = 0n17)+0x1bb
[C:\dll\postgres\postgres_head\src\backend\executor\execProcnode.c @ 209]
06 postgres!ExecInitAppend(struct Append * node = 0x00000000`021b3c78,
struct EState * estate = 0x00000000`0219f2c8, int eflags = 0n17)+0x301
[C:\dll\postgres\postgres_head\src\backend\executor\nodeAppend.c @ 232]
07 postgres!ExecInitNode(struct Plan * node = 0x00000000`021b3c78, struct
EState * estate = 0x00000000`0219f2c8, int eflags = 0n17)+0xf8
[C:\dll\postgres\postgres_head\src\backend\executor\execProcnode.c @ 181]
08 postgres!ExecInitAgg(struct Agg * node = 0x00000000`021b4688, struct
EState * estate = 0x00000000`0219f2c8, int eflags = 0n17)+0x559
[C:\dll\postgres\postgres_head\src\backend\executor\nodeAgg.c @ 3383]
09 postgres!ExecInitNode(struct Plan * node = 0x00000000`021b4688, struct
EState * estate = 0x00000000`0219f2c8, int eflags = 0n17)+0x58a
[C:\dll\postgres\postgres_head\src\backend\executor\execProcnode.c @ 340]
0a postgres!InitPlan(struct QueryDesc * queryDesc = 0x00000000`021b5e48,
int eflags = 0n17)+0x490
[C:\dll\postgres\postgres_head\src\backend\executor\execMain.c @ 936]
0b postgres!standard_ExecutorStart(struct QueryDesc * queryDesc =
0x00000000`021b5e48, int eflags = 0n17)+0x242
[C:\dll\postgres\postgres_head\src\backend\executor\execMain.c @ 265]
0c postgres!ExecutorStart(struct QueryDesc * queryDesc =
0x00000000`021b5e48, int eflags = 0n1)+0x4a
[C:\dll\postgres\postgres_head\src\backend\executor\execMain.c @ 144]
0d postgres!ExplainOnePlan(struct PlannedStmt * plannedstmt =
0x00000000`021b5db8, struct IntoClause * into = 0x00000000`00000000, struct
ExplainState * es = 0x00000000`021831f8, char * queryString =
0x00000000`00999348 "explain (costs off) select count(*) from tbl t1 where
(exists(select 1 from tbl t2 where t2.c1 = t1.c2) or c3 < 0);", struct
ParamListInfoData * params = 0x00000000`00000000, struct QueryEnvironment *
queryEnv = 0x00000000`00000000, union _LARGE_INTEGER * planduration =
0x00000000`007ff160 {5127}, struct BufferUsage * bufusage =
0x00000000`00000000)+0x197
[C:\dll\postgres\postgres_head\src\backend\commands\explain.c @ 582]
0e postgres!ExplainOneQuery(struct Query * query = 0x00000000`0099a5d0, int
cursorOptions = 0n2048, struct IntoClause * into = 0x00000000`00000000,
struct ExplainState * es = 0x00000000`021831f8, char * queryString =
0x00000000`00999348 "explain (costs off) select count(*) from tbl t1 where
(exists(select 1 from tbl t2 where t2.c1 = t1.c2) or c3 < 0);", struct
ParamListInfoData * params = 0x00000000`00000000, struct QueryEnvironment *
queryEnv = 0x00000000`00000000)+0x210
[C:\dll\postgres\postgres_head\src\backend\commands\explain.c @ 413]
0f postgres!ExplainQuery(struct ParseState * pstate = 0x00000000`0099de20,
struct ExplainStmt * stmt = 0x00000000`0099a410, struct ParamListInfoData *
params = 0x00000000`00000000, struct _DestReceiver * dest =
0x00000000`0099dd90)+0x72f
[C:\dll\postgres\postgres_head\src\backend\commands\explain.c @ 286]
10 postgres!standard_ProcessUtility(struct PlannedStmt * pstmt =
0x00000000`02197808, char * queryString = 0x00000000`00999348 "explain
(costs off) select count(*) from tbl t1 where (exists(select 1 from tbl t2
where t2.c1 = t1.c2) or c3 < 0);", bool readOnlyTree = false,
ProcessUtilityContext context = PROCESS_UTILITY_TOPLEVEL (0n0), struct
ParamListInfoData * params = 0x00000000`00000000, struct QueryEnvironment *
queryEnv = 0x00000000`00000000, struct _DestReceiver * dest =
0x00000000`0099dd90, struct QueryCompletion * qc =
0x00000000`007ff630)+0x8f1
[C:\dll\postgres\postgres_head\src\backend\tcop\utility.c @ 846]
11 postgres!ProcessUtility(struct PlannedStmt * pstmt =
0x00000000`02197808, char * queryString = 0x00000000`00999348 "explain
(costs off) select count(*) from tbl t1 where (exists(select 1 from tbl t2
where t2.c1 = t1.c2) or c3 < 0);", bool readOnlyTree = false,
ProcessUtilityContext context = PROCESS_UTILITY_TOPLEVEL (0n0), struct
ParamListInfoData * params = 0x00000000`00000000, struct QueryEnvironment *
queryEnv = 0x00000000`00000000, struct _DestReceiver * dest =
0x00000000`0099dd90, struct QueryCompletion * qc =
0x00000000`007ff630)+0xb5
[C:\dll\postgres\postgres_head\src\backend\tcop\utility.c @ 530]
12 postgres!PortalRunUtility(struct PortalData * portal =
0x00000000`0095cd38, struct PlannedStmt * pstmt = 0x00000000`02197808, bool
isTopLevel = true, bool setHoldSnapshot = true, struct _DestReceiver * dest
= 0x00000000`0099dd90, struct QueryCompletion * qc =
0x00000000`007ff630)+0x135
[C:\dll\postgres\postgres_head\src\backend\tcop\pquery.c @ 1157]
13 postgres!FillPortalStore(struct PortalData * portal =
0x00000000`0095cd38, bool isTopLevel = true)+0x105
[C:\dll\postgres\postgres_head\src\backend\tcop\pquery.c @ 1028]

regards,
Ranier Vilela

Reply via email to