pgsql: Use heap_modify_tuple not SPI_modifytuple in pl/perl triggers.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Use heap_modify_tuple not SPI_modifytuple in pl/perl triggers.
Date: 2016-11-08 16:35:27
Message-ID: E1c49Mt-0006sQ-OK@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Use heap_modify_tuple not SPI_modifytuple in pl/perl triggers.

The code here would need some change anyway given planned change in
SPI_modifytuple semantics, since this executes after we've exited the
SPI environment. But really it's better to just use heap_modify_tuple.
The code's actually shorter this way, and this avoids depending on some
rather indirect reasoning about why the temporary arrays can't be overrun.
(I think the old code is safe, as long as Perl hashes can't contain
duplicate keys; but with this way we don't need that assumption, only
the assumption that SPI_fnumber doesn't return an out-of-range attnum.)

While at it, normalize use of SPI_fnumber: make error messages distinguish
no-such-column from can't-set-system-column, and remove test for deleted
column which is going to migrate into SPI_fnumber.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/0d4446083df56a36ecec8e8bd321a45ecac7e7c6

Modified Files
--------------
src/pl/plperl/plperl.c | 56 ++++++++++++++++++++++----------------------------
1 file changed, 25 insertions(+), 31 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2016-11-08 17:00:33 pgsql: Use heap_modify_tuple not SPI_modifytuple in pl/python triggers.
Previous Message Robert Haas 2016-11-08 15:53:24 pgsql: Improve handling of dead tuples in hash indexes.