pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Granting of permissions on tables
5+ messages / 3 participants
[nested] [flat]

* Granting of permissions on tables
@ 2000-10-05 21:12 Saltsgaver, Scott <scottsa@aiinet.com>
  2000-10-05 21:26 ` Re: Granting of permissions on tables Peter Eisentraut <peter_e@gmx.net>
  2000-10-05 21:37 ` Re: Granting of permissions on tables Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 5+ messages in thread

From: Saltsgaver, Scott @ 2000-10-05 21:12 UTC (permalink / raw)
  To: pgsql-sql

I have PostgreSQL v7.02 running on a HP-UX 11.00 box.  I as the owner of
some tables granted permissions to another user.  I executed the following
command from psql

GRANT ALL on <tables here> to <user2>;

after running the command I lost permissions to the tables once I exited
psql.  I had to run psql as the postgres user to correct the situation.

Is this a bug or desired behavior?  I would imagine since I owned the tables
and then granted permissions to another user, I wouldn't lose my
permissions.

Any help or explanation would be appreciated.

Thanks,
Scott Saltsgaver




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Granting of permissions on tables
  2000-10-05 21:12 Granting of permissions on tables Saltsgaver, Scott <scottsa@aiinet.com>
@ 2000-10-05 21:26 ` Peter Eisentraut <peter_e@gmx.net>
  1 sibling, 0 replies; 5+ messages in thread

From: Peter Eisentraut @ 2000-10-05 21:26 UTC (permalink / raw)
  To: Saltsgaver, Scott <scottsa@aiinet.com>; +Cc: pgsql-sql

Saltsgaver, Scott writes:

> GRANT ALL on <tables here> to <user2>;
> 
> after running the command I lost permissions to the tables once I exited
> psql.  I had to run psql as the postgres user to correct the situation.
> 
> Is this a bug or desired behavior?

It's a bug.  Fixed for 7.1.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Granting of permissions on tables
  2000-10-05 21:12 Granting of permissions on tables Saltsgaver, Scott <scottsa@aiinet.com>
@ 2000-10-05 21:37 ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 5+ messages in thread

From: Tom Lane @ 2000-10-05 21:37 UTC (permalink / raw)
  To: Saltsgaver, Scott <scottsa@aiinet.com>; +Cc: pgsql-sql

"Saltsgaver, Scott" <scottsa@aiinet.com> writes:
> Is this a bug or desired behavior?  I would imagine since I owned the tables
> and then granted permissions to another user, I wouldn't lose my
> permissions.

It's a bug, or at least a misfeature.  As long as you haven't done any
explicit grants or revokes, 7.0 uses an implicit access control list
that grants all privileges to the owner and none to anyone else.
However, the moment you do any explicit grant/revoke, that implicit
ACL entry for the owner isn't used anymore.  You have to explicitly
grant rights to yourself again :-(.

You don't need superuser help to do this, you just have to do
	GRANT ALL ON table TO yourself
as the table owner.  But it's stupid to have to do that when it's
supposed to be the default condition.  Fixed for 7.1.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* RE: Granting of permissions on tables
@ 2000-10-06 13:25 Saltsgaver, Scott <scottsa@aiinet.com>
  2000-10-06 15:07 ` Re: Granting of permissions on tables Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 5+ messages in thread

From: Saltsgaver, Scott @ 2000-10-06 13:25 UTC (permalink / raw)
  To: pgsql-sql

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.

Thanks for everyone's help.  So would an exceptable workaround be to grant
permissions to yourself first and then to all other users?

Scott

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Thursday, October 05, 2000 5:38 PM
To: Saltsgaver, Scott
Cc: 'pgsql-sql@postgresql.org'
Subject: Re: [SQL] Granting of permissions on tables 


"Saltsgaver, Scott" <scottsa@aiinet.com> writes:
> Is this a bug or desired behavior?  I would imagine since I owned the
tables
> and then granted permissions to another user, I wouldn't lose my
> permissions.

It's a bug, or at least a misfeature.  As long as you haven't done any
explicit grants or revokes, 7.0 uses an implicit access control list
that grants all privileges to the owner and none to anyone else.
However, the moment you do any explicit grant/revoke, that implicit
ACL entry for the owner isn't used anymore.  You have to explicitly
grant rights to yourself again :-(.

You don't need superuser help to do this, you just have to do
	GRANT ALL ON table TO yourself
as the table owner.  But it's stupid to have to do that when it's
supposed to be the default condition.  Fixed for 7.1.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Granting of permissions on tables
  2000-10-06 13:25 RE: Granting of permissions on tables Saltsgaver, Scott <scottsa@aiinet.com>
@ 2000-10-06 15:07 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2000-10-06 15:07 UTC (permalink / raw)
  To: Saltsgaver, Scott <scottsa@aiinet.com>; +Cc: pgsql-sql

"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 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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2000-10-06 15:07 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-10-05 21:12 Granting of permissions on tables Saltsgaver, Scott <scottsa@aiinet.com>
2000-10-05 21:26 ` Peter Eisentraut <peter_e@gmx.net>
2000-10-05 21:37 ` Tom Lane <tgl@sss.pgh.pa.us>
2000-10-06 13:25 RE: Granting of permissions on tables Saltsgaver, Scott <scottsa@aiinet.com>
2000-10-06 15:07 ` 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