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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Xnerv Wang <xnervwang(at)gmail(dot)com>
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 19:58:11
Message-ID: 1873099.1795723091@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Xnerv Wang <xnervwang(at)gmail(dot)com> writes:
> 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.

Pushed with minor cosmetic adjustments (mostly the comments). I left
out the test cases though; couldn't convince myself they were worth
memorializing given the simpler coding.

BTW, Andreas wondered why pg_input_is_valid() doesn't take a regtype
argument. I think the reason is it wouldn't pass the typmod through,
so we'd lose the ability to test cases like

regression=# select pg_input_error_info('abcdef', 'char(4)');
pg_input_error_info
--------------------------------------------------
("value too long for type character(4)",,,22001)
(1 row)

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Antonin Houska 2026-11-26 20:16:46 Re: Allow progress tracking of sub-commands
Previous Message Lukas Fittl 2026-11-26 19:52:46 Re: Unify parallel worker handling for index builds and instrumentation