postgresql/contrib/spi
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
..
autoinc--1.0.sql
autoinc--unpackaged--1.0.sql
autoinc.c Replace uses of SPI_modifytuple that intend to allocate in current context. 2016-11-08 15:36:44 -05:00
autoinc.control
autoinc.example
insert_username--1.0.sql
insert_username--unpackaged--1.0.sql
insert_username.c Replace uses of SPI_modifytuple that intend to allocate in current context. 2016-11-08 15:36:44 -05:00
insert_username.control
insert_username.example
Makefile
moddatetime--1.0.sql
moddatetime--unpackaged--1.0.sql
moddatetime.c Replace uses of SPI_modifytuple that intend to allocate in current context. 2016-11-08 15:36:44 -05:00
moddatetime.control
moddatetime.example
refint--1.0.sql
refint--unpackaged--1.0.sql
refint.c
refint.control
refint.example
timetravel--1.0.sql
timetravel--unpackaged--1.0.sql
timetravel.c Replace uses of SPI_modifytuple that intend to allocate in current context. 2016-11-08 15:36:44 -05:00
timetravel.control
timetravel.example