> I'm able to create the object as shown in the below: > > postgres=# CREATE OR REPLACE FUNCTION pg_catalog.nont_ext_func() RETURNS char AS $$ BEGIN return 'v'; END; $$ LANGUAGE plpgsql; > CREATE FUNCTION > > Why can't we strictly restrict object creation in pg_catalog?
Do you have allow_system_table_mods set to ON by any chance? As Laurenz said, such creation is already restricted, but it can be circumvented by using said GUC (which is *not* intended for production usage).
-- Daniel Gustafsson
It's OFF.
postgres=# select version(); version ---------------------------------------------------------------------------------------------------------------- PostgreSQL 18beta1 on aarch64-unknown-linux-gnu, compiled by gcc (Ubuntu 14.2.0-4ubuntu2~24.04) 14.2.0, 64-bit (1 row) postgres=# show allow_system_table_mods ; allow_system_table_mods ------------------------- off (1 row) postgres=# CREATE FUNCTION pg_catalog.nont_ext_func() RETURNS char AS $$ BEGIN return 'v'; END; $$ LANGUAGE plpgsql; CREATE FUNCTION postgres=# \df+ nont_ext_func List of functions Schema | Name | Result data type | Argument data types | Type | Volatility | Parallel | Owner | Security | Lea kproof? | Access privileges | Language | Internal name | Description ------------+---------------+------------------+---------------------+------+------------+----------+---------+----------+---- --------+-------------------+----------+---------------+------------- pg_catalog | nont_ext_func | character | | func | volatile | unsafe | vaibhav | invoker | no | | plpgsql | | (1 row)