Last active
December 28, 2015 00:29
-
-
Save ringerc/7413693 to your computer and use it in GitHub Desktop.
Simple DELETE FROM t plan, parse, and rewrite trees; PostgreSQL 9.3, see https://wiki.postgresql.org/wiki/Automatically_updatable_security_barrier_views#How_does_updating_a_join_work.3F
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
regress=> DELETE FROM t; | |
LOG: parse tree: | |
DETAIL: {QUERY | |
:commandType 4 | |
:querySource 0 | |
:canSetTag true | |
:utilityStmt <> | |
:resultRelation 1 | |
:hasAggs false | |
:hasWindowFuncs false | |
:hasSubLinks false | |
:hasDistinctOn false | |
:hasRecursive false | |
:hasModifyingCTE false | |
:hasForUpdate false | |
:cteList <> | |
:rtable ( | |
{RTE | |
:alias <> | |
:eref | |
{ALIAS | |
:aliasname t | |
:colnames ("id" "secret") | |
} | |
:rtekind 0 | |
:relid 16387 | |
:relkind r | |
:lateral false | |
:inh true | |
:inFromCl false | |
:requiredPerms 8 | |
:checkAsUser 0 | |
:selectedCols (b) | |
:modifiedCols (b) | |
} | |
) | |
:jointree | |
{FROMEXPR | |
:fromlist ( | |
{RANGETBLREF | |
:rtindex 1 | |
} | |
) | |
:quals <> | |
} | |
:targetList <> | |
:returningList <> | |
:groupClause <> | |
:havingQual <> | |
:windowClause <> | |
:distinctClause <> | |
:sortClause <> | |
:limitOffset <> | |
:limitCount <> | |
:rowMarks <> | |
:setOperations <> | |
:constraintDeps <> | |
} | |
LOG: rewritten parse tree: | |
DETAIL: ( | |
{QUERY | |
:commandType 4 | |
:querySource 0 | |
:canSetTag true | |
:utilityStmt <> | |
:resultRelation 1 | |
:hasAggs false | |
:hasWindowFuncs false | |
:hasSubLinks false | |
:hasDistinctOn false | |
:hasRecursive false | |
:hasModifyingCTE false | |
:hasForUpdate false | |
:cteList <> | |
:rtable ( | |
{RTE | |
:alias <> | |
:eref | |
{ALIAS | |
:aliasname t | |
:colnames ("id" "secret") | |
} | |
:rtekind 0 | |
:relid 16387 | |
:relkind r | |
:lateral false | |
:inh true | |
:inFromCl false | |
:requiredPerms 8 | |
:checkAsUser 0 | |
:selectedCols (b) | |
:modifiedCols (b) | |
} | |
) | |
:jointree | |
{FROMEXPR | |
:fromlist ( | |
{RANGETBLREF | |
:rtindex 1 | |
} | |
) | |
:quals <> | |
} | |
:targetList ( | |
{TARGETENTRY | |
:expr | |
{VAR | |
:varno 1 | |
:varattno -1 | |
:vartype 27 | |
:vartypmod -1 | |
:varcollid 0 | |
:varlevelsup 0 | |
:varnoold 1 | |
:varoattno -1 | |
:location -1 | |
} | |
:resno 1 | |
:resname ctid | |
:ressortgroupref 0 | |
:resorigtbl 0 | |
:resorigcol 0 | |
:resjunk true | |
} | |
) | |
:returningList <> | |
:groupClause <> | |
:havingQual <> | |
:windowClause <> | |
:distinctClause <> | |
:sortClause <> | |
:limitOffset <> | |
:limitCount <> | |
:rowMarks <> | |
:setOperations <> | |
:constraintDeps <> | |
} | |
) | |
LOG: plan: | |
DETAIL: {PLANNEDSTMT | |
:commandType 4 | |
:queryId 0 | |
:hasReturning false | |
:hasModifyingCTE false | |
:canSetTag true | |
:transientPlan false | |
:planTree | |
{MODIFYTABLE | |
:startup_cost 0.00 | |
:total_cost 22.30 | |
:plan_rows 1230 | |
:plan_width 6 | |
:targetlist <> | |
:qual <> | |
:lefttree <> | |
:righttree <> | |
:initPlan <> | |
:extParam (b) | |
:allParam (b) | |
:operation 4 | |
:canSetTag true | |
:resultRelations (i 1) | |
:resultRelIndex 0 | |
:plans ( | |
{SEQSCAN | |
:startup_cost 0.00 | |
:total_cost 22.30 | |
:plan_rows 1230 | |
:plan_width 6 | |
:targetlist ( | |
{TARGETENTRY | |
:expr | |
{VAR | |
:varno 1 | |
:varattno -1 | |
:vartype 27 | |
:vartypmod -1 | |
:varcollid 0 | |
:varlevelsup 0 | |
:varnoold 1 | |
:varoattno -1 | |
:location -1 | |
} | |
:resno 1 | |
:resname ctid | |
:ressortgroupref 0 | |
:resorigtbl 0 | |
:resorigcol 0 | |
:resjunk true | |
} | |
) | |
:qual <> | |
:lefttree <> | |
:righttree <> | |
:initPlan <> | |
:extParam (b 0) | |
:allParam (b 0) | |
:scanrelid 1 | |
} | |
) | |
:returningLists <> | |
:fdwPrivLists (<>) | |
:rowMarks <> | |
:epqParam 0 | |
} | |
:rtable ( | |
{RTE | |
:alias <> | |
:eref | |
{ALIAS | |
:aliasname t | |
:colnames ("id" "secret") | |
} | |
:rtekind 0 | |
:relid 16387 | |
:relkind r | |
:lateral false | |
:inh false | |
:inFromCl false | |
:requiredPerms 8 | |
:checkAsUser 0 | |
:selectedCols (b) | |
:modifiedCols (b) | |
} | |
) | |
:resultRelations (i 1) | |
:utilityStmt <> | |
:subplans <> | |
:rewindPlanIDs (b) | |
:rowMarks <> | |
:relationOids (o 16387) | |
:invalItems <> | |
:nParamExec 1 | |
} | |
DELETE 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment