]> granicus.if.org Git - postgresql/commit
Fix race condition in DELETE RETURNING.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 10 Mar 2013 23:18:53 +0000 (19:18 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 10 Mar 2013 23:18:53 +0000 (19:18 -0400)
commit8d4bb31618c6f4f251e372cef62a86bb2f9cd1b4
tree37eac4ac2504c14f5216961bfe9a3333f8dc1094
parent1dd92380b00781b8318d6d3fb2817468e43fe3a5
Fix race condition in DELETE RETURNING.

When RETURNING is specified, ExecDelete would return a virtual-tuple slot
that could contain pointers into an already-unpinned disk buffer.  Another
process could change the buffer contents before we get around to using the
data, resulting in garbage results or even a crash.  This seems of fairly
low probability, which may explain why there are no known field reports of
the problem, but it's definitely possible.  Fix by forcing the result slot
to be "materialized" before we release pin on the disk buffer.

Back-patch to 9.0; in earlier branches there is no bug because
ExecProcessReturning sent the tuple to the destination immediately.  Also,
this is already fixed in HEAD as part of the writable-foreign-tables patch
(where the fix is necessary for DELETE RETURNING to work at all with
postgres_fdw).
src/backend/executor/nodeModifyTable.c