Re: Using Expanded Objects other than Arrays from plpgsql

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com>
Cc: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, Michel Pelletier <pelletier(dot)michel(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Using Expanded Objects other than Arrays from plpgsql
Date: 2025-02-02 21:56:59
Message-ID: 256915.1738533419@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

I wrote:
> Hmm, it seemed to still apply for me. But anyway, I needed to make
> the other changes, so here's v4.

I decided to see what would happen if we tried to avoid the code
duplication in pl_funcs.c by making some "walker" infrastructure
akin to expression_tree_walker. While that doesn't seem useful
for the dump_xxx functions, it works very nicely for the free_xxx
functions and now for the mark_xxx ones as well. pl_funcs.c
nets out about 400 lines shorter than in the v4 patch. The
code coverage score for the file is still awful :-(, but that's
because we're not testing the dump_xxx functions at all.

PFA v5. The new 0001 patch refactors the free_xxx infrastructure
to create plpgsql_statement_tree_walker(), and then in what's now
0003 we can use that instead of writing a lot of duplicate code.

regards, tom lane

Attachment Content-Type Size
v5-0001-Refactor-pl_funcs.c-to-provide-a-usage-independen.patch text/x-diff 17.4 KB
v5-0002-Preliminary-refactoring.patch text/x-diff 9.9 KB
v5-0003-Detect-whether-plpgsql-assignment-targets-are-loc.patch text/x-diff 10.2 KB
v5-0004-Implement-new-optimization-rule-for-updates-of-ex.patch text/x-diff 26.8 KB
v5-0005-Allow-extension-functions-to-participate-in-in-pl.patch text/x-diff 17.1 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marcelo Fernandes 2025-02-02 23:05:51 Logging queries executed by SPI_execute
Previous Message Adrian Klaver 2025-02-02 21:33:51 Re: Log retention query

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-02-02 22:01:33 Re: [PATCH] Fix incorrect range in pg_regress comment
Previous Message Jelte Fennema-Nio 2025-02-02 21:46:55 Re: [PATCH] Fix incorrect range in pg_regress comment