]> granicus.if.org Git - postgresql/commit
Fix ON CONFLICT bugs that manifest when used in rules.
authorAndres Freund <andres@anarazel.de>
Tue, 12 May 2015 22:13:22 +0000 (00:13 +0200)
committerAndres Freund <andres@anarazel.de>
Tue, 12 May 2015 22:13:22 +0000 (00:13 +0200)
commit4af6e61a363246cf7fff3368a76603b0ce9945dd
tree95812a969e049a62dedc89eb60c96304b81f5a5a
parent5c7df74204e2fb9440b576518d40fcf3ac65c8ac
Fix ON CONFLICT bugs that manifest when used in rules.

Specifically the tlist and rti of the pseudo "excluded" relation weren't
properly treated by expression_tree_walker, which lead to errors when
excluded was referenced inside a rule because the varnos where not
properly adjusted.  Similar omissions in OffsetVarNodes and
expression_tree_mutator had less impact, but should obviously be fixed
nonetheless.

A couple tests of for ON CONFLICT UPDATE into INSERT rule bearing
relations have been added.

In passing I updated a couple comments.
src/backend/executor/nodeModifyTable.c
src/backend/nodes/nodeFuncs.c
src/backend/optimizer/plan/setrefs.c
src/backend/rewrite/rewriteManip.c
src/test/regress/expected/rules.out
src/test/regress/sql/rules.sql