postgresql/src/backend/utils
Tom Lane 9257f07872 Replace uses of SPI_modifytuple that intend to allocate in current context.
Invent a new function heap_modify_tuple_by_cols() that is functionally
equivalent to SPI_modifytuple except that it always allocates its result
by simple palloc.  I chose however to make the API details a bit more
like heap_modify_tuple: pass a tupdesc rather than a Relation, and use
bool convention for the isnull array.

Use this function in place of SPI_modifytuple at all call sites where the
intended behavior is to allocate in current context.  (There actually are
only two call sites left that depend on the old behavior, which makes me
wonder if we should just drop this function rather than keep it.)

This new function is easier to use than heap_modify_tuple() for purposes
of replacing a single column (or, really, any fixed number of columns).
There are a number of places where it would simplify the code to change
over, but I resisted that temptation for the moment ... everywhere except
in plpgsql's exec_assign_value(); changing that might offer some small
performance benefit, so I did it.

This is on the way to removing SPI_push/SPI_pop, but it seems like
good code cleanup in its own right.

Discussion: <9633.1478552022@sss.pgh.pa.us>
2016-11-08 15:36:44 -05:00
..
adt Replace uses of SPI_modifytuple that intend to allocate in current context. 2016-11-08 15:36:44 -05:00
cache Remove unnecessary int2vector-specific hash function and equality operator. 2016-10-12 14:54:08 -04:00
error Add a nonlocalized version of the severity field to client error messages. 2016-08-26 16:20:17 -04:00
fmgr Add a noreturn attribute to help static analyzers 2016-10-09 21:36:42 -04:00
hash Add macros to make AllocSetContextCreate() calls simpler and safer. 2016-08-27 17:50:38 -04:00
init Add macros to make AllocSetContextCreate() calls simpler and safer. 2016-08-27 17:50:38 -04:00
mb Add make rules to download raw Unicode mapping files 2016-11-01 11:54:58 -04:00
misc Fix mistake in XLOG_SEG_SIZE test. 2016-11-08 12:12:19 -05:00
mmgr Make AllocSetContextCreate throw an error for bad context-size parameters. 2016-08-29 09:29:26 -04:00
resowner pgindent run for 9.6 2016-06-09 18:02:36 -04:00
sort Fix use-after-free around DISTINCT transition function calls. 2016-10-17 12:13:16 +03:00
time Fix deletion of speculatively inserted TOAST on conflict 2016-08-17 17:03:36 -07:00
.gitignore Avoid maintaining three separate copies of the error codes list. 2011-02-03 22:32:49 -05:00
Gen_dummy_probes.pl Finish pgindent run for 9.6: Perl files. 2016-06-12 04:19:56 -04:00
Gen_dummy_probes.sed Update copyright for 2016 2016-01-02 13:33:40 -05:00
Gen_fmgrtab.pl Update copyright for 2016 2016-01-02 13:33:40 -05:00
Makefile Make handling of errcodes.h more consistent with other generated headers. 2011-02-04 09:29:10 -05:00
errcodes.txt Relax transactional restrictions on ALTER TYPE ... ADD VALUE. 2016-09-05 12:59:55 -04:00
generate-errcodes.pl Update copyright for 2016 2016-01-02 13:33:40 -05:00
probes.d Refer to OS X as "macOS", except for the port name which is still "darwin". 2016-09-25 15:40:57 -04:00