Fix oversight in initial implementation of PORTAL_ONE_RETURNING mode: we

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 65b2f93b587be67ea1d5e4d98a99599937aa7b19
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2006-08-14T22:57:15Z
Releases: 8.2.0
Fix oversight in initial implementation of PORTAL_ONE_RETURNING mode: we
cannot assume that there's exactly one Query in the Portal, as we can for
ONE_SELECT mode, because non-SELECT queries might have extra queries added
during rule rewrites.  Fix things up so that we'll use ONE_RETURNING mode
when a Portal contains one primary (canSetTag) query and that query has
a RETURNING list.  This appears to be a second showstopper reason for running
the Portal to completion before we start to hand anything back --- we want
to be sure that the rule-added queries get run too.

Files

PathChange+/−
src/backend/commands/prepare.c modified +3 −3
src/backend/executor/spi.c modified +49 −38
src/backend/tcop/pquery.c modified +46 −16
src/backend/utils/mmgr/portalmem.c modified +29 −1
src/include/utils/portal.h modified +10 −5