tmp dbg parse tree

【tmp dbg parse tree】psql -p 5691

-- STUDENT(学生编号,姓名,性别) create table STUDENT (sno INT primary key, sname VARCHAR(10), ssex INT); -- COURSE (课程编号,课程名,教师编号) create table COURSE (cno INT primary key, cname VARCHAR(10), tno INT); -- SCORE (学号, 课程编号,分数) create table SCORE (sno INT, cno INT, degree INT); -- TEACHER(教师编号,姓名,性别) create table TEACHER (tno INT primary key, tname VARCHAR(10), tsex INT);

select sname from student;

2022-09-27 13:45:43.027 UTC [24012] LOG:parse tree: 2022-09-27 13:45:43.027 UTC [24012] DETAIL:{QUERY :commandType 1 :querySource 0 :canSetTag true :utilityStmt <> :resultRelation 0 :hasAggs false :hasWindowFuncs false :hasTargetSRFs false :hasSubLinks false :hasDistinctOn false :hasRecursive false :hasModifyingCTE false :hasForUpdate false :hasRowSecurity false :isReturn false :cteList <> :rtable ( {RTE :alias <> :eref {ALIAS :aliasname student :colnames ("sno" "sname" "ssex") } :rtekind 0 :relid 16568 :relkind r :rellockmode 1 :tablesample <> :lateral false :inh true :inFromCl true :requiredPerms 2 :checkAsUser 0 :selectedCols (b 9) :insertedCols (b) :updatedCols (b) :extraUpdatedCols (b) :securityQuals <> } ) :jointree {FROMEXPR :fromlist ( {RANGETBLREF :rtindex 1 } ) :quals <> } :targetList ( {TARGETENTRY :expr {VAR :varno 1 :varattno 2 :vartype 1043 :vartypmod 14 :varcollid 100 :varlevelsup 0 :varnosyn 1 :varattnosyn 2 :location 7 } :resno 1 :resname sname :ressortgroupref 0 :resorigtbl 16568 :resorigcol 2 :resjunk false } ) :override 0 :onConflict <> :returningList <> :groupClause <> :groupDistinct false :groupingSets <> :havingQual <> :windowClause <> :distinctClause <> :sortClause <> :limitOffset <> :limitCount <> :limitOption 0 :rowMarks <> :setOperations <> :constraintDeps <> :withCheckOptions <> :stmt_location 0 :stmt_len 25 }

select * from student left join score on TRUE, (select * from teacher) as t, course, (values(1,1)) as NUM(x, y), generate_series(1,10) as GS(z);

select sname, sno from student;

2022-09-28 15:28:50.268 UTC [1214] LOG:statement: select sname, sno from student; 2022-09-28 15:28:50.268 UTC [1214] LOG:rawtree haha tree: 2022-09-28 15:28:50.268 UTC [1214] DETAIL:{RAWSTMT :stmt {SELECT :distinctClause <> :intoClause <> :targetList ( {RESTARGET :name <> :indirection <> :val {COLUMNREF :fields ("sname") :location 7 } :location 7 } {RESTARGET :name <> :indirection <> :val {COLUMNREF :fields ("sno") :location 14 } :location 14 } ) :fromClause ( {RANGEVAR :schemaname <> :relname student :inh true :relpersistence p :alias <> :location 23 } ) :whereClause <> :groupClause <> :groupDistinct false :havingClause <> :windowClause <> :valuesLists <> :sortClause <> :limitOffset <> :limitCount <> :limitOption 0 :lockingClause <> :withClause <> :op 0 :all false :larg <> :rarg <> } :stmt_location 0 :stmt_len 30 }2022-09-28 15:28:50.268 UTC [1214] STATEMENT:select sname, sno from student; 2022-09-28 15:28:50.268 UTC [1214] LOG:parse tree: 2022-09-28 15:28:50.268 UTC [1214] DETAIL:{QUERY :commandType 1 :querySource 0 :canSetTag true :utilityStmt <> :resultRelation 0 :hasAggs false :hasWindowFuncs false :hasTargetSRFs false :hasSubLinks false :hasDistinctOn false :hasRecursive false :hasModifyingCTE false :hasForUpdate false :hasRowSecurity false :isReturn false :cteList <> :rtable ( {RTE :alias <> :eref {ALIAS :aliasname student :colnames ("sno" "sname" "ssex") } :rtekind 0 :relid 16568 :relkind r :rellockmode 1 :tablesample <> :lateral false :inh true :inFromCl true :requiredPerms 2 :checkAsUser 0 :selectedCols (b 8 9) :insertedCols (b) :updatedCols (b) :extraUpdatedCols (b) :securityQuals <> } ) :jointree {FROMEXPR :fromlist ( {RANGETBLREF :rtindex 1 } ) :quals <> } :targetList ( {TARGETENTRY :expr {VAR :varno 1 :varattno 2 :vartype 1043 :vartypmod 14 :varcollid 100 :varlevelsup 0 :varnosyn 1 :varattnosyn 2 :location 7 } :resno 1 :resname sname :ressortgroupref 0 :resorigtbl 16568 :resorigcol 2 :resjunk false } {TARGETENTRY :expr {VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnosyn 1 :varattnosyn 1 :location 14 } :resno 2 :resname sno :ressortgroupref 0 :resorigtbl 16568 :resorigcol 1 :resjunk false } ) :override 0 :onConflict <> :returningList <> :groupClause <> :groupDistinct false :groupingSets <> :havingQual <> :windowClause <> :distinctClause <> :sortClause <> :limitOffset <> :limitCount <> :limitOption 0 :rowMarks <> :setOperations <> :constraintDeps <> :withCheckOptions <> :stmt_location 0 :stmt_len 30 }2022-09-28 15:28:50.268 UTC [1214] STATEMENT:select sname, sno from student; 2022-09-28 15:28:50.268 UTC [1214] LOG:rewritten parse tree: 2022-09-28 15:28:50.268 UTC [1214] DETAIL:( {QUERY :commandType 1 :querySource 0 :canSetTag true :utilityStmt <> :resultRelation 0 :hasAggs false :hasWindowFuncs false :hasTargetSRFs false :hasSubLinks false :hasDistinctOn false :hasRecursive false :hasModifyingCTE false :hasForUpdate false :hasRowSecurity false :isReturn false :cteList <> :rtable ( {RTE :alias <> :eref {ALIAS :aliasname student :colnames ("sno" "sname" "ssex") } :rtekind 0 :relid 16568 :relkind r :rellockmode 1 :tablesample <> :lateral false :inh true :inFromCl true :requiredPerms 2 :checkAsUser 0 :selectedCols (b 8 9) :insertedCols (b) :updatedCols (b) :extraUpdatedCols (b) :securityQuals <> } ) :jointree {FROMEXPR :fromlist ( {RANGETBLREF :rtindex 1 } ) :quals <> } :targetList ( {TARGETENTRY :expr {VAR :varno 1 :varattno 2 :vartype 1043 :vartypmod 14 :varcollid 100 :varlevelsup 0 :varnosyn 1 :varattnosyn 2 :location 7 } :resno 1 :resname sname :ressortgroupref 0 :resorigtbl 16568 :resorigcol 2 :resjunk false } {TARGETENTRY :expr {VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnosyn 1 :varattnosyn 1 :location 14 } :resno 2 :resname sno :ressortgroupref 0 :resorigtbl 16568 :resorigcol 1 :resjunk false } ) :override 0 :onConflict <> :returningList <> :groupClause <> :groupDistinct false :groupingSets <> :havingQual <> :windowClause <> :distinctClause <> :sortClause <> :limitOffset <> :limitCount <> :limitOption 0 :rowMarks <> :setOperations <> :constraintDeps <> :withCheckOptions <> :stmt_location 0 :stmt_len 30 } )2022-09-28 15:28:50.268 UTC [1214] STATEMENT:select sname, sno from student; 2022-09-28 15:28:50.268 UTC [1214] LOG:plan: 2022-09-28 15:28:50.268 UTC [1214] DETAIL:{PLANNEDSTMT :commandType 1 :queryId 0 :hasReturning false :hasModifyingCTE false :canSetTag true :transientPlan false :dependsOnRole false :parallelModeNeeded false :jitFlags 0 :planTree {SEQSCAN :startup_cost 0.00 :total_cost 21.00 :plan_rows 1100 :plan_width 42 :parallel_aware false :parallel_safe true :async_capable false :plan_node_id 0 :targetlist ( {TARGETENTRY :expr {VAR :varno 1 :varattno 2 :vartype 1043 :vartypmod 14 :varcollid 100 :varlevelsup 0 :varnosyn 1 :varattnosyn 2 :location 7 } :resno 1 :resname sname :ressortgroupref 0 :resorigtbl 16568 :resorigcol 2 :resjunk false } {TARGETENTRY :expr {VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnosyn 1 :varattnosyn 1 :location 14 } :resno 2 :resname sno :ressortgroupref 0 :resorigtbl 16568 :resorigcol 1 :resjunk false } ) :qual <> :lefttree <> :righttree <> :initPlan <> :extParam (b) :allParam (b) :scanrelid 1 } :rtable ( {RTE :alias <> :eref {ALIAS :aliasname student :colnames ("sno" "sname" "ssex") } :rtekind 0 :relid 16568 :relkind r :rellockmode 1 :tablesample <> :lateral false :inh false :inFromCl true :requiredPerms 2 :checkAsUser 0 :selectedCols (b 8 9) :insertedCols (b) :updatedCols (b) :extraUpdatedCols (b) :securityQuals <> } ) :resultRelations <> :appendRelations <> :subplans <> :rewindPlanIDs (b) :rowMarks <> :relationOids (o 16568) :invalItems <> :paramExecTypes <> :utilityStmt <> :stmt_location 0 :stmt_len 30 }

    推荐阅读