pgsql: Generalize plpgsql's heuristic for importing expanded objects.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Generalize plpgsql's heuristic for importing expanded objects.
Date: 2024-10-24 17:28:36
Message-ID: E1t41dV-002G3e-AC@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Generalize plpgsql's heuristic for importing expanded objects.

If a R/W expanded-object pointer is passed as a function parameter,
take ownership of the object, regardless of its type. Previously
this happened only for expanded arrays, but that was a result of
sloppy thinking. (If the plpgsql function did not end by returning
the object, the result would be to leak the object until the
surrounding memory context is cleaned up. That's not awful,
since non-expanded values have always been managed that way,
but we can do better.)

Per discussion with Michel Pelletier. There's a lot more to do
here to make plpgsql work efficiently with expanded objects that
aren't arrays, but this is an easy first step.

Discussion: https://postgr.es/m/CACxu=vJaKFNsYxooSnW1wEgsAO5u_v1XYBacfVJ14wgJV_PYeg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/534d0ea6c2b915ac9745d2f070afacd7ba003d28

Modified Files
--------------
src/pl/plpgsql/src/pl_exec.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Jeff Davis 2024-10-24 19:09:12 pgsql: Add functions pg_restore_relation_stats(), pg_restore_attribute_
Previous Message Noah Misch 2024-10-24 16:20:26 pgsql: Stop reading uninitialized memory in heap_inplace_lock().