Re: [DEPARSE] Parameters in SQL-standard function bodies do not read back

From: Henson Choi <assam258(at)gmail(dot)com>
To: Sho Ito <i(dot)sho(dot)0628(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [DEPARSE] Parameters in SQL-standard function bodies do not read back
Date: 2026-11-13 02:19:05
Message-ID: CAAAe_zCna1wYmsCKPryFdEpZpWD96P-5KONPfczwxXk7DPhHDA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Sho,

> I found no issues with the fix.

Thanks for the review, and for the extra round trips through
pg_get_functiondef() and pg_dump.

Attached is v2, rebased over two recent commits that added tests to
create_function_sql.sql on master and on 15-19.

One of them is "Fix assorted confusion about parameter names.",
whose message notes as a remaining issue that a parameter qualified
with the function name can be captured when the function name
matches a table alias used within the function. That is the case
this patch fixes.

That commit also makes unnamed parameters print as $N, so v2 drops
the empty-name check from 0002, and the functest_unnamed output in
0001 already shows $2.

v2 also adds one test, functest_capout, with an output parameter
first, an unnamed input and a table named like the function, so that
both fixes are exercised together. Otherwise the patches are the
same as v1.

As before, the two .patch files apply as they are to REL_18_STABLE
and REL_19_STABLE, and the .txt files are the versions for 15-17. On
every branch from 15 to master, make check passes with 0001 alone and
with both patches.

Best regards,
Henson

Attachment Content-Type Size
REL_17-v2-0001-Add-tests-for-parameter-references-in-SQL-function-.txt text/plain 22.9 KB
v2-0001-Add-tests-for-parameter-references-in-SQL-functio.patch application/octet-stream 27.4 KB
v2-0002-Fix-deparse-of-parameter-references-in-SQL-functi.patch application/octet-stream 18.5 KB
REL_17-v2-0002-Fix-deparse-of-parameter-references-in-SQL-function.txt text/plain 17.5 KB
REL_16-v2-0001-Add-tests-for-parameter-references-in-SQL-function-.txt text/plain 22.9 KB
REL_16-v2-0002-Fix-deparse-of-parameter-references-in-SQL-function.txt text/plain 17.6 KB
REL_15-v2-0001-Add-tests-for-parameter-references-in-SQL-function-.txt text/plain 22.9 KB
REL_15-v2-0002-Fix-deparse-of-parameter-references-in-SQL-function.txt text/plain 18.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Henson Choi 2026-11-13 02:20:39 Re: Row pattern recognition
Previous Message Henson Choi 2026-11-13 02:17:18 Re: [DEPARSE] Operators on ROW() constructors read back as row comparisons