Re: pg_upgrade fails with an error "object doesn't exist" - Mailing list pgsql-hackers

From Vaibhav Dalvi
Subject Re: pg_upgrade fails with an error "object doesn't exist"
Date
Msg-id CA+vB=AGCxuAkbXLJ195aaBwSvyihMMNNP0Nc954obRhsMOwGSw@mail.gmail.com
Whole thread Raw
In response to Re: pg_upgrade fails with an error "object doesn't exist"  (Daniel Gustafsson <daniel@yesql.se>)
List pgsql-hackers
Hi Daniel,

Thanks for your response.

On Mon, Jun 16, 2025 at 1:27 PM Daniel Gustafsson <daniel@yesql.se> wrote:
> On 16 Jun 2025, at 09:29, Vaibhav Dalvi <vaibhav.dalvi@enterprisedb.com> wrote:

> 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)

 
Regards,
Vaibhav

pgsql-hackers by date:

Previous
From: Потапов Александр
Date:
Subject: Re: Init connection time grows quadratically
Next
From: Daniel Gustafsson
Date:
Subject: Re: No error checking when reading from file using zstd in pg_dump