]> granicus.if.org Git - postgresql/commit
Fix an old corner-case bug in set_config_option: push_old_value has to be
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 26 May 2008 18:54:50 +0000 (18:54 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 26 May 2008 18:54:50 +0000 (18:54 +0000)
commit48ecee132852b1631b9b6ec5d5fe9c0b9ab5ac98
tree19f50dba561d2e61eb773369ed22b89879a09318
parent04bd1fce2ad4c122fd9d843a9a2d9b15504d973d
Fix an old corner-case bug in set_config_option: push_old_value has to be
called before, not after, calling the assign_hook if any.  This is because
push_old_value might fail (due to palloc out-of-memory), and in that case
there would be no stack entry to tell transaction abort to undo the GUC
assignment.  Of course the actual assignment to the GUC variable hasn't
happened yet --- but the assign_hook might have altered subsidiary state.
Without a stack entry we won't call it again to make it undo such actions.
So this is necessary to make the world safe for assign_hooks with side
effects.  Per a discussion a couple weeks ago with Magnus.

Back-patch to 8.0.  7.x did not have the problem because it did not have
allocatable stacks of GUC values.
src/backend/utils/misc/guc.c