debug_print_rewritten
A configuration parameter controlling whether the query rewriter output for a query is logged
debug_print_rewritten
is a configuration parameter controlling whether the query rewriter output for a query is logged.
debug_print_rewritten
was added in PostgreSQL 7.1.
Default value
The default value for debug_print_rewritten
is: off
.
Change history
- PostgreSQL 8.4
- output appears at
LOG
message level (previously:DEBUG1
) (commit 9650830b)
- output appears at
- PostgreSQL 7.1
- (commit 6a68f426)
Examples
Sample output with debug_print_rewritten
enabled for an arbitrary query (here an INSERT
into a partitioned table):
[2020-08-16 15:03:12 UTC] psql postgres postgres LOG: 00000: statement: INSERT INTO part_parent values(1,'foo') returning *; [2020-08-16 15:03:12 UTC] psql postgres postgres LOCATION: exec_simple_query, postgres.c:1044 [2020-08-16 15:03:12 UTC] psql postgres postgres LOG: 00000: rewritten parse tree: [2020-08-16 15:03:12 UTC] psql postgres postgres DETAIL: ( {QUERY :commandType 3 :querySource 0 :canSetTag true :utilityStmt <> :resultRelation 1 :hasAggs false :hasWindowFuncs false :hasTargetSRFs false :hasSubLinks false :hasDistinctOn false :hasRecursive false :hasModifyingCTE false :hasForUpdate false :hasRowSecurity false :cteList <> :rtable ( {RTE :alias <> :eref {ALIAS :aliasname part_parent :colnames ("id" "val") } :rtekind 0 :relid 16490 :relkind p :rellockmode 3 :tablesample <> :lateral false :inh false :inFromCl false :requiredPerms 3 :checkAsUser 0 :selectedCols (b 8 9) :insertedCols (b 8 9) :updatedCols (b) :extraUpdatedCols (b) :securityQuals <> } ) :jointree {FROMEXPR :fromlist <> :quals <> } :targetList ( {TARGETENTRY :expr {CONST :consttype 23 :consttypmod -1 :constcollid 0 :constlen 4 :constbyval true :constisnull false :location 31 :constvalue 4 [ 1 0 0 0 0 0 0 0 ] } :resno 1 :resname id :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk false } {TARGETENTRY :expr {FUNCEXPR :funcid 669 :funcresulttype 1043 :funcretset false :funcvariadic false :funcformat 2 :funccollid 100 :inputcollid 100 :args ( {CONST :consttype 1043 :consttypmod -1 :constcollid 100 :constlen -1 :constbyval false :constisnull false :location 33 :constvalue 7 [ 28 0 0 0 102 111 111 ] } {CONST :consttype 23 :consttypmod -1 :constcollid 0 :constlen 4 :constbyval true :constisnull false :location -1 :constvalue 4 [ 36 0 0 0 0 0 0 0 ] } {CONST :consttype 16 :consttypmod -1 :constcollid 0 :constlen 1 :constbyval true :constisnull false :location -1 :constvalue 1 [ 0 0 0 0 0 0 0 0 ] } ) :location -1 } :resno 2 :resname val :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk false } ) :override 0 :onConflict <> :returningList ( {TARGETENTRY :expr {VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1 :varcollid 0 :varlevelsup 0 :varnosyn 1 :varattnosyn 1 :location 51 } :resno 1 :resname id :ressortgroupref 0 :resorigtbl 16490 :resorigcol 1 :resjunk false } {TARGETENTRY :expr {VAR :varno 1 :varattno 2 :vartype 1043 :vartypmod 36 :varcollid 100 :varlevelsup 0 :varnosyn 1 :varattnosyn 2 :location 51 } :resno 2 :resname val :ressortgroupref 0 :resorigtbl 16490 :resorigcol 2 :resjunk false } ) :groupClause <> :groupingSets <> :havingQual <> :windowClause <> :distinctClause <> :sortClause <> :limitOffset <> :limitCount <> :limitOption 0 :rowMarks <> :setOperations <> :constraintDeps <> :withCheckOptions <> :stmt_location 0 :stmt_len 52 } ) [2020-08-16 15:03:12 UTC] psql postgres postgres LOCATION: elog_node_display, print.c:85
References
- PostgreSQL documentation: debug_print_rewritten