Disallow calling anything but plain functions via the fastpath API.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 30 Apr 2021 18:10:26 +0000 (14:10 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 30 Apr 2021 18:10:26 +0000 (14:10 -0400)
commit2efcd502e56a528f75ec8e88c02a287ad3457d77
tree88470e4471a373dc1fb6237356d80e601a17f324
parentee4ba01dbbc31daa083f434ecd603a80bbe50501
Disallow calling anything but plain functions via the fastpath API.

Reject aggregates, window functions, and procedures.  Aggregates
failed anyway, though with a somewhat obscure error message.
Window functions would hit an Assert or null-pointer dereference.
Procedures seemed to work as long as you didn't try to do
transaction control, but (a) transaction control is sort of the
point of a procedure, and (b) it's not entirely clear that no
bugs lurk in that path.  Given the lack of testing of this area,
it seems safest to be conservative in what we support.

Also reject proretset functions, as the fastpath protocol can't
support returning a set.

Also remove an easily-triggered assertion that the given OID
isn't 0; the subsequent lookups can handle that case themselves.

Per report from Theodor-Arsenij Larionov-Trichkin.
Back-patch to all supported branches.  (The procedure angle
only applies in v11+, of course.)

Discussion: https://postgr.es/m/2039442.1615317309@sss.pgh.pa.us
src/backend/tcop/fastpath.c