Re: Cast to regrole on a literal string in a PL/pgSQL function

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: LEMAIRE Leslie (Chargée de mission) - SG/DNUM/UNI/DRC <leslie.lemaire@developpement-durable.gouv.fr>
Cc: pgsql-bugs@lists.postgresql.org
Date: 2025-09-30T15:29:51Z
Lists: pgsql-bugs
=?UTF-8?Q?LEMAIRE_Leslie_=28Charg=C3=A9e_de_mission=29_=2D_SG=2FDNUM=2F?= =?UTF-8?Q?UNI=2FDRC?= <leslie.lemaire@developpement-durable.gouv.fr> writes:
> I'm surprised that regnamespace isn't handled properly either, by the 
> way. One test can't prove much, but this one doesn't fail with a cast to 
> regnamespace, unlike all other reg* except regclass.

regnamespace constants do work, accidentally, because plancache.c
is set up to flush *all* cached plans after any change in
pg_namespace.  That's because the possible effects on search-path
lookups are too hard to predict.

Now that I look, regoper/regoperator constants would probably be okay
too, because changes in pg_operator also cause a plancache flush.

			regards, tom lane