sql - Read-only user able to create table -
i created read-only user in postgresql , still able create tables:
i created test db , created readonly2
user. gave select privileges on 2 tables. when log db readonly2
user still able create tables:
create database test1 create user readonly2 password 'readonly'; grant select on test1 readonly2 grant select on test2 readonly2
where test1
, test2
2 tables in test db.
now when log test db readonly2
user, able create tables:
test=> create table test55 (id int); create table
i want create read-only user select permissions. not want grant create table permissions.
every table created in schema in postgres. create table, role must have create
privilege schema. per documentation:
create
... schemas, allows new objects created within schema.
the default schema table created in first schema of current search_path
.
the first schema in search_path typically schema same name user or schema public
.
and public
schema comes default privileges:
a user can allowed create objects in else's schema. allow that, create
privilege on schema needs granted. note default, everyone has create
, usage
privileges on schema public.
bold emphasis mine.
you can alter that:
revoke create on schema public public;
be sure think consequences first ...
(either that, or role superuser.)
sql postgresql user database-permissions
No comments:
Post a Comment