Re: Granting of permissions on tables

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Saltsgaver, Scott" <scottsa(at)aiinet(dot)com>
Cc: "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Granting of permissions on tables
Date: 2000-10-06 15:07:05
Message-ID: 25420.970844825@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Saltsgaver, Scott" <scottsa(at)aiinet(dot)com> writes:
> After I ran into this condition, the first thing I tried was to grant
> permissions back to myself. PostgreSQL shot me down with a permission
> denied error. So I had to log is as the superuser and then grant
> permissions to myself.

Are you sure about that? What version are you running? I get

play=> select version();
version
------------------------------------------------------------------
PostgreSQL 7.0.2 on hppa2.0-hp-hpux10.20, compiled by gcc 2.95.2
(1 row)

play=> select usename, usesuper from pg_user;
usename | usesuper
----------+----------
postgres | t
tgl | f
tree | f
(3 rows)

play=> select current_user;
getpgusername
---------------
tgl
(1 row)

play=> create table bar (f1 int);
CREATE
play=> select * from bar;
f1
----
(0 rows)

play=> grant all on bar to tree;
CHANGE
play=> select * from bar;
ERROR: bar: Permission denied.
play=> grant all on bar to tgl;
CHANGE
play=> select * from bar;
f1
----
(0 rows)

play=>

AFAICT from both experiment and looking at the sources, a table
owner is allowed to change the table's access permissions whether
or not he's currently got any permissions granted to himself;
ie, changing permissions is not a grantable/revokable right,
it's just checked on the basis of who you are.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2000-10-06 16:31:44 Re: Re: [HACKERS] Counting bool flags in a complex query
Previous Message Saltsgaver, Scott 2000-10-06 13:25:15 RE: Granting of permissions on tables