fix(postgres): know PostgreSQL 19's catalog functions and refuse regdatabase

PostgreSQL 19 adds 41 functions to pg_catalog that the plugin guard's
catalog list did not hold, so PGPLUG-021 failed on the 19 lane and a plugin
could call the new ones the allowlist does not name. They are now in
catalog-functions.txt, taken from 19's pg_proc.dat; none of them joins the
plugin allowlist.

19 also adds the object identifier type regdatabase, whose input looks a
database of the cluster up by its name. A cast to it passed the guard, so a
plugin could probe which databases the server holds. It now joins the other
name lookup types, its array type with it.
This commit is contained in:
Maurice
2026-11-27 20:31:53 +01:00
parent 39d2196a14
commit 2dc505eff2
3 changed files with 48 additions and 0 deletions
@@ -268,6 +268,11 @@ describe('plugin SQL guard', () => {
["select 'english'::regconfig", /"regconfig" may not be named/],
["select 'simple'::regdictionary", /"regdictionary" may not be named/],
["select '{public.users}'::_regclass", /"_regclass" may not be named/],
// PostgreSQL 19's regdatabase looks a database of the cluster up by its name.
["select 'postgres'::regdatabase::oid", /"regdatabase" may not be named/],
["select cast('other_app' as regdatabase)", /"regdatabase" may not be named/],
["select '{postgres}'::_regdatabase", /"_regdatabase" may not be named/],
["select to_regdatabase('other_app')", /"to_regdatabase" may not be named/],
["select 'x'::pg_catalog.regtype", /"pg_catalog" may not be named/],
["select has_table_privilege('public.users', 'select')", /"has_table_privilege" may not be named/],
["select currtid2('public.users', '(0,1)')", /"currtid2" may not be named/],