| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
| Cc: | Peter Eisentraut <peter(at)eisentraut(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: POC: PLpgSQL FOREACH IN JSON ARRAY |
| Date: | 2026-07-01 21:40:04 |
| Message-ID: | 3648848.1782942004@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
I took a very quick look through the v20260616 patch.
I think you need to work harder on the separation of knowledge.
In particular I don't like that the type-specific setup routines
(create_foreach_a_array_iterator etc) contain so many assumptions that
they are being called from a PLpgsql FOREACH statement and nothing
else. IMO the point of putting this into the SubscriptRoutines
infrastructure is to make a general-purpose facility that could be
used by different things. So:
* it's not clear to me that these routines have any business knowing
about the "target type"; they certainly shouldn't contain comments
alluding to PLpgSQL's conversion abilities. I think probably you
just want them to pass back the data type they are producing and
let PLpgSQL decide whether it wants to convert or not.
* we need to think about how the error messages could be phrased more
generically, or else not have these functions throw those errors
themselves but instead pass back an error code that the caller could
use to select an error message. I suspect this will end up with
visible changes in the error messages produced by existing cases,
and that's okay IMO.
* memory management may need to be rethought a bit as well.
Certainly the comments referencing exec_eval_cleanup do not
belong here.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Zsolt Parragi | 2026-07-01 22:00:48 | Re: SLOPE - Planner optimizations on monotonic expressions. |
| Previous Message | Nathan Bossart | 2026-07-01 21:38:14 | add list of major features to the v19 release notes |