pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedSuperUser permission denied when creating table.
5+ messages / 3 participants
[nested] [flat]
* SuperUser permission denied when creating table.
@ 2019-07-09 12:31 Dave Hughes <dhughes20@gmail.com>
0 siblings, 2 replies; 5+ messages in thread
From: Dave Hughes @ 2019-07-09 12:31 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
I recently noticed that my default superuser "postgres" cannot create
tables in new schemas I create, but can in some existing ones.
So as the postgres user I ran:
afleads=# create schema mytest;
CREATE SCHEMA
afleads=# create table mytest.test (col1 int);
ERROR: permission denied for schema mytest
LINE 1: create table mytest.test (col1 int);
So I tried to give usage & connect permission to another superuser I have,
but I get the same error:
afleads=# GRANT USAGE, CREATE ON SCHEMA mytest TO dhughes;
GRANT
afleads=# set role dhughes;
SET
afleads=# create table mytest.test (col1 int);
ERROR: permission denied for schema mytest
LINE 1: create table mytest.test (col1 int);
So then I gave the same usage & create permission to a non-superuser. It's
a group role we have:
afleads=# GRANT USAGE, CREATE ON SCHEMA mytest TO creator_role;
GRANT
afleads=# set role creator_role;
SET
afleads=> create table mytest.test (col1 int);
CREATE TABLE
And then it works. This has me baffled as to why the two superusers I have
do not have the permissions to create a table, when non-superusers can
(once granted permissions).
However I still seem to be able to create tables in older schemas I have:
afleads=# select current_role;
current_role
--------------
postgres
(1 row)
afleads=# create table timeline.test (col1 int);
CREATE TABLE
Has anyone ran across something like this before?
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: SuperUser permission denied when creating table.
@ 2019-07-09 13:28 Achilleas Mantzios <achill@matrix.gatewaynet.com>
parent: Dave Hughes <dhughes20@gmail.com>
1 sibling, 1 reply; 5+ messages in thread
From: Achilleas Mantzios @ 2019-07-09 13:28 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 9/7/19 3:31 μ.μ., Dave Hughes wrote:
>
> Has anyone ran across something like this before?
can you show your pg_dumpall -x --schema-only
?
--
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: SuperUser permission denied when creating table.
@ 2019-07-09 13:50 Dave Hughes <dhughes20@gmail.com>
parent: Achilleas Mantzios <achill@matrix.gatewaynet.com>
0 siblings, 1 reply; 5+ messages in thread
From: Dave Hughes @ 2019-07-09 13:50 UTC (permalink / raw)
To: Achilleas Mantzios <achill@matrix.gatewaynet.com>; +Cc: pgsql-general@lists.postgresql.org
Sure thing. I attached it as a txt file. Thanks for the help!
On Tue, Jul 9, 2019 at 9:29 AM Achilleas Mantzios <
achill@matrix.gatewaynet.com> wrote:
> On 9/7/19 3:31 μ.μ., Dave Hughes wrote:
> >
> > Has anyone ran across something like this before?
>
> can you show your pg_dumpall -x --schema-only
> ?
>
> --
> Achilleas Mantzios
> IT DEV Lead
> IT DEPT
> Dynacom Tankers Mgmt
>
>
>
>
Attachments:
schema_output.txt (text/plain, 497.7K) download
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: SuperUser permission denied when creating table.
@ 2019-07-09 14:08 Achilleas Mantzios <achill@matrix.gatewaynet.com>
parent: Dave Hughes <dhughes20@gmail.com>
0 siblings, 0 replies; 5+ messages in thread
From: Achilleas Mantzios @ 2019-07-09 14:08 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 9/7/19 4:50 μ.μ., Dave Hughes wrote:
> Sure thing. I attached it as a txt file. Thanks for the help!
PostgreSQL version?
>
> On Tue, Jul 9, 2019 at 9:29 AM Achilleas Mantzios <achill@matrix.gatewaynet.com <mailto:achill@matrix.gatewaynet.com>> wrote:
>
> On 9/7/19 3:31 μ.μ., Dave Hughes wrote:
> >
> > Has anyone ran across something like this before?
>
> can you show your pg_dumpall -x --schema-only
> ?
>
> --
> Achilleas Mantzios
> IT DEV Lead
> IT DEPT
> Dynacom Tankers Mgmt
>
>
>
--
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: SuperUser permission denied when creating table.
@ 2019-07-09 14:14 Tom Lane <tgl@sss.pgh.pa.us>
parent: Dave Hughes <dhughes20@gmail.com>
1 sibling, 0 replies; 5+ messages in thread
From: Tom Lane @ 2019-07-09 14:14 UTC (permalink / raw)
To: Dave Hughes <dhughes20@gmail.com>; +Cc: pgsql-general@lists.postgresql.org
Dave Hughes <dhughes20@gmail.com> writes:
> I recently noticed that my default superuser "postgres" cannot create
> tables in new schemas I create, but can in some existing ones.
> So as the postgres user I ran:
> afleads=# create schema mytest;
> CREATE SCHEMA
> afleads=# create table mytest.test (col1 int);
> ERROR: permission denied for schema mytest
> LINE 1: create table mytest.test (col1 int);
I think you're shooting yourself in the foot with those event triggers,
ie trg_create_table is switching the role to something that lacks
permissions to do the CREATE.
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2019-07-09 14:14 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-07-09 12:31 SuperUser permission denied when creating table. Dave Hughes <dhughes20@gmail.com>
2019-07-09 13:28 ` Achilleas Mantzios <achill@matrix.gatewaynet.com>
2019-07-09 13:50 ` Dave Hughes <dhughes20@gmail.com>
2019-07-09 14:08 ` Achilleas Mantzios <achill@matrix.gatewaynet.com>
2019-07-09 14:14 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox