BUG #14590: something wrong when create extension in schema pg_catalog

Started by 德哥about 9 years ago2 messagesbugs
Jump to latest
#1德哥
digoal@126.com

The following bug has been logged on the website:

Bug reference: 14590
Logged by: Zhou Digoal
Email address: digoal@126.com
PostgreSQL version: 9.6.2
Operating system: CentOS 6.x x64
Description:

```
cd $PGHOME/share/extension

cp btree_gist--1.2.sql btree_gist--9.9.9.sql

vi btree_gist--9.9.9.sql
-- add this
create type new_type as (
id int,
c1 int
);
```

test

```
postgres=# create extension btree_gist with schema pg_catalog;
CREATE EXTENSION
postgres=# drop extension btree_gist ;
DROP EXTENSION

postgres=# \set VERBOSITY verbose
postgres=# create extension btree_gist with schema pg_catalog version
'9.9.9';
ERROR: 42501: permission denied to create "pg_catalog.new_type"
DETAIL: System catalog modifications are currently disallowed.
LOCATION: heap_create, heap.c:280
```

but why can do this?

```
postgres=# create extension btree_gist version '9.9.9';;
CREATE EXTENSION
postgres=# alter extension btree_gist set schema pg_catalog;
ALTER EXTENSION
```

and why can do this?

```
vi $PGDATA/postgresql.conf
allow_system_table_mods=on

pg_ctl restart -m fast

postgres=# create extension btree_gist with schema pg_catalog version
'9.9.9';
CREATE EXTENSION
```

table, composite type, seq ... in extension sql, so cann't create in
pg_catalog?

it's a bug?

best regards
digoal

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: 德哥 (#1)
Re: BUG #14590: something wrong when create extension in schema pg_catalog

digoal@126.com writes:

postgres=# create extension btree_gist with schema pg_catalog;

I would say that that's neither a good idea nor a supported operation.
If it happens to work in some cases, okay, but you're definitely taking
risks of getting tripped up by the restrictions on pg_catalog...

ERROR: 42501: permission denied to create "pg_catalog.new_type"
DETAIL: System catalog modifications are currently disallowed.

... like that one.

regards, tom lane

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs