postgresql/src/include/executor
Tom Lane 1833f1a1c3 Simplify code by getting rid of SPI_push, SPI_pop, SPI_restore_connection.
The idea behind SPI_push was to allow transitioning back into an
"unconnected" state when a SPI-using procedure calls unrelated code that
might or might not invoke SPI.  That sounds good, but in practice the only
thing it does for us is to catch cases where a called SPI-using function
forgets to call SPI_connect --- which is a highly improbable failure mode,
since it would be exposed immediately by direct testing of said function.
As against that, we've had multiple bugs induced by forgetting to call
SPI_push/SPI_pop around code that might invoke SPI-using functions; these
are much harder to catch and indeed have gone undetected for years in some
cases.  And we've had to band-aid around some problems of this ilk by
introducing conditional push/pop pairs in some places, which really kind
of defeats the purpose altogether; if we can't draw bright lines between
connected and unconnected code, what's the point?

Hence, get rid of SPI_push[_conditional], SPI_pop[_conditional], and the
underlying state variable _SPI_curid.  It turns out SPI_restore_connection
can go away too, which is a nice side benefit since it was never more than
a kluge.  Provide no-op macros for the deleted functions so as to avoid an
API break for external modules.

A side effect of this removal is that SPI_palloc and allied functions no
longer permit being called when unconnected; they'll throw an error
instead.  The apparent usefulness of the previous behavior was a mirage
as well, because it was depended on by only a few places (which I fixed in
preceding commits), and it posed a risk of allocations being unexpectedly
long-lived if someone forgot a SPI_push call.

Discussion: <20808.1478481403@sss.pgh.pa.us>
2016-11-08 17:39:57 -05:00
..
execdebug.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
execdesc.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
execParallel.h pgindent run for 9.6 2016-06-09 18:02:36 -04:00
executor.h Use more efficient hashtable for execGrouping.c to speed up hash aggregation. 2016-10-14 17:22:51 -07:00
functions.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
hashjoin.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
instrument.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeAgg.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeAppend.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeBitmapAnd.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeBitmapHeapscan.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeBitmapIndexscan.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeBitmapOr.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeCtescan.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeCustom.h pgindent run for 9.6 2016-06-09 18:02:36 -04:00
nodeForeignscan.h pgindent run for 9.6 2016-06-09 18:02:36 -04:00
nodeFunctionscan.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeGather.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeGroup.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeHash.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeHashjoin.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeIndexonlyscan.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeIndexscan.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeLimit.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeLockRows.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeMaterial.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeMergeAppend.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeMergejoin.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeModifyTable.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeNestloop.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeRecursiveunion.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeResult.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeSamplescan.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeSeqscan.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeSetOp.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeSort.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeSubplan.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeSubqueryscan.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeTidscan.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeUnique.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeValuesscan.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeWindowAgg.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodeWorktablescan.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
spi.h Simplify code by getting rid of SPI_push, SPI_pop, SPI_restore_connection. 2016-11-08 17:39:57 -05:00
spi_priv.h Widen query numbers-of-tuples-processed counters to uint64. 2016-03-12 16:05:29 -05:00
tqueue.h Fix worst memory leaks in tqueue.c. 2016-07-29 19:31:06 -04:00
tstoreReceiver.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
tuptable.h Mark read/write expanded values as read-only in ExecProject(). 2016-06-03 15:14:50 -04:00