Re: [PATCH] pg_input_is_valid() reuses the first type name inside a PL/pgSQL loop

From: Xnerv Wang <xnervwang(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andreas Karlsson <andreas(at)proxel(dot)se>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, John Naylor <johncnaylorls(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] pg_input_is_valid() reuses the first type name inside a PL/pgSQL loop
Date: 2026-11-26 00:16:46
Message-ID: CAFEh72AyOjuadDzBu5s0p=AMaUeiE0q5q+PgkjMxCwJpgCMOEg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Nov 25, 2026 at 11:43 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Let's just drop the attempt to skip executing parseTypeString().

In the attached v3, pg_input_is_valid_common() uses parseTypeString()
to resolve the type name on each call. It caches only the type's input
function and looks it up again when the type OID changes. The
typname_constant flag and the get_fn_expr_arg_stable() check are gone.

The new plpgsql_simple cases fail without the fix. They cover a loop
where type names and typmods change, dropping and recreating a domain
under the same name, and a search_path change between two FETCHes from
a cursor. check-world passes with assertions, TAP tests and injection
points enabled.

Thanks,
Xnerv Wang
Amazon Web Services

Attachment Content-Type Size
v3-0001-Fix-stale-type-lookups-in-pg_input_is_valid_commo.patch text/x-patch 8.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message Andreas Karlsson 2026-11-26 00:10:26 Re: passwordcheck: Make the user name check case-insensitive