Re: Privileges on public schema can't be revoked?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Fodor <gfodor(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Privileges on public schema can't be revoked?
Date: 2016-09-06 18:07:16
Message-ID: 7490.1473185236@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greg Fodor <gfodor(at)gmail(dot)com> writes:
> Apologies in advance about this since it is likely something obvious,
> but I am seeing some very basic behavior that does not make sense.
> I've tested this on a fresh build of 9.6rc1 and also 9.1.24 (just to
> see if it was a regression.) After creating a test database, and a
> test user that I revoke all privileges on the public schema to, yet
> that user is still able to create tables in the public schema.

You would need to revoke the default grant of privileges to PUBLIC;
revokes against any particular user have no effect on his being
a member of PUBLIC.

IOW, revoke only revokes a previous matching grant, and there was
no such grant in this case. What there was was a grant to PUBLIC;
see the relevant bit in initdb.c:

"GRANT CREATE, USAGE ON SCHEMA public TO PUBLIC;\n\n",

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Naveed Shaikh 2016-09-06 18:08:19 Re: PostgreSQL Database performance
Previous Message Stephen Frost 2016-09-06 17:52:41 Re: Privileges on public schema can't be revoked?