Re: Using Expanded Objects other than Arrays from plpgsql

Michel Pelletier <pelletier.michel@gmail.com>

From: Michel Pelletier <pelletier.michel@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Pavel Stehule <pavel.stehule@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2024-11-25T02:02:17Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Allow extension functions to participate in in-place updates.

  2. Implement new optimization rule for updates of expanded variables.

  3. Detect whether plpgsql assignment targets are "local" variables.

  4. Preliminary refactoring of plpgsql expression construction.

  5. Refactor pl_funcs.c to provide a usage-independent tree walker.

  6. Generalize plpgsql's heuristic for importing expanded objects.

Attachments

On Tue, Nov 19, 2024 at 12:52 PM Michel Pelletier <
pelletier.michel@gmail.com> wrote:

> On Tue, Nov 19, 2024 at 11:45 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
>> Pavel Stehule <pavel.stehule@gmail.com> writes:
>> > another position can be src/test/modules - I think so your example is
>> > "similar" to plsample
>>
>> Yeah.  I think we've largely adopted the position that contrib should
>> contain installable modules that do something potentially useful to
>> end-users.  A pure skeleton wouldn't be that, but if it's fleshed out
>> enough to be test code for some core features then src/test/modules
>> could be a reasonable home.
>>
>
> Great!  I'll put a patch together that adds the skeleton object to
> src/test/modules and I'll write some expected tests that run the expansion
> through its paces, when the support function feature happens I'll update it
> to include tests for that.
>

Here's a WIP patch for a pgexpanded example in src/test/modules.  The
object is very simple and starts with an integer and increments that value
every time it is expanded.  I added some regression tests that test two sql
functions that replicate the expansion issue that I'm seeing with my
extension.

I considered a more complex data type like a linked list, something that
could maybe also showcase subscripting support for expanded objects, but I
didn't want to go too far without discussion.

-Michel

>