"Saltsgaver, Scott" <scottsa@aiinet.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
gcc2.95.2
(1 row)
play=> select usename, usesuper from pg_user;usename | usesuper
----------+----------postgres | ttgl | ftree | 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