pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
table permissions
8+ messages / 6 participants
[nested] [flat]

* table permissions
@ 2001-11-22 10:39 MG <makgab@freemail.hu>
  2001-11-24 03:06 ` Re: table permissions Chad R. Larson <chad@eldocomp.com>
  2001-11-24 22:46 ` Re: table permissions Ian Barwick <barwick@gmx.net>
  2001-11-25 17:01 ` Re: table permissions Ian Barwick <barwick@gmx.net>
  2001-11-26 14:52 ` Re: table permissions Andrew G. Hammond <drew@xyzzy.dhs.org>
  0 siblings, 4 replies; 8+ messages in thread

From: MG @ 2001-11-22 10:39 UTC (permalink / raw)
  To: pgsql-admin


Hi!

I subscribe to this list now. :) I have a question.
How can I query (in SQL) the user permissions of a table? Which system table
stores the tables permissions for the user?

Bye!
----------------
Linux Redhat 7.1
----------------



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

* Re: table permissions
  2001-11-22 10:39 table permissions MG <makgab@freemail.hu>
@ 2001-11-24 03:06 ` Chad R. Larson <chad@eldocomp.com>
  3 siblings, 0 replies; 8+ messages in thread

From: Chad R. Larson @ 2001-11-24 03:06 UTC (permalink / raw)
  To: MG <makgab@freemail.hu>; pgsql-admin

At 10:39 AM 11/22/01 +0000, MG wrote:
>How can I query (in SQL) the user permissions of a table? Which system table
>stores the tables permissions for the user?

   select * from pg_user ;


         -crl
--
Chad R. Larson (CRL22)    chad@eldocomp.com
   Eldorado Computing, Inc.   602-604-3100
      5353 North 16th Street, Suite 400
        Phoenix, Arizona   85016-3228




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

* Re: table permissions
  2001-11-22 10:39 table permissions MG <makgab@freemail.hu>
@ 2001-11-24 22:46 ` Ian Barwick <barwick@gmx.net>
  3 siblings, 0 replies; 8+ messages in thread

From: Ian Barwick @ 2001-11-24 22:46 UTC (permalink / raw)
  To: MG <makgab@freemail.hu>; pgsql-admin

On Thursday 22 November 2001 11:39, MG wrote:
> Hi!
>
> I subscribe to this list now. :) I have a question.
> How can I query (in SQL) the user permissions of a table? Which system
> table stores the tables permissions for the user?

Sounds like you are looking for pg_class, column relacl.
See:

http://www.postgresql.org/idocs/index.php?catalog-pg-class.html

HTH 

Ian Barwick



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

* Re: table permissions
  2001-11-22 10:39 table permissions MG <makgab@freemail.hu>
@ 2001-11-25 17:01 ` Ian Barwick <barwick@gmx.net>
  3 siblings, 0 replies; 8+ messages in thread

From: Ian Barwick @ 2001-11-25 17:01 UTC (permalink / raw)
  To: pgsql-admin

On Thursday 22 November 2001 11:39, MG wrote:
> Hi!
>
> I subscribe to this list now. :) I have a question.
> How can I query (in SQL) the user permissions of a table? Which system
> table stores the tables permissions for the user?

Sounds like you are looking for table pg_class, column relacl.
See:

http://www.postgresql.org/idocs/index.php?catalog-pg-class.html

HTH 

Ian Barwick




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

* Re: table permissions
  2001-11-22 10:39 table permissions MG <makgab@freemail.hu>
@ 2001-11-26 14:52 ` Andrew G. Hammond <drew@xyzzy.dhs.org>
  3 siblings, 0 replies; 8+ messages in thread

From: Andrew G. Hammond @ 2001-11-26 14:52 UTC (permalink / raw)
  To: MG <makgab@freemail.hu>; pgsql-admin

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2001 November 22 05:39 am, MG wrote:

> I subscribe to this list now. :) I have a question.
> How can I query (in SQL) the user permissions of a table? Which system
> table stores the tables permissions for the user?

psql -E test
\dp

displays the query used by psql to list permissions in the filesystem:

SELECT relname as "Relation",
       relacl as "Access permissions"
FROM   pg_class
WHERE  relkind in ('r', 'v', 'S') AND
       relname !~ '^pg_'
ORDER BY relname


- -- 
Andrew G. Hammond     mailto:drew@xyzzy.dhs.org   http://xyzzy.dhs.org/~drew/
56 2A 54 EF 19 C0 3B 43 72 69 5B E3 69 5B A1 1F                  613-389-5481
5CD3 62B0 254B DEB1 86E0  8959 093E F70A B457 84B1
"To blow recursion you must first blow recur" -- me
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAjwCVycACgkQCT73CrRXhLE+1gCeOSoMV8Qp9cKijAHxTuxamMPz
m0wAn21MFM/y7+BneRF4BpzZKG33bNWq
=/JIx
-----END PGP SIGNATURE-----



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

* Table permissions
@ 2006-03-26 20:34 Milen Dzhumerov <gamehack@gmail.com>
  2006-03-26 23:10 ` Re: Table permissions Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 1 reply; 8+ messages in thread

From: Milen Dzhumerov @ 2006-03-26 20:34 UTC (permalink / raw)
  To: pgsql-admin

Hi all,

I had the need to find the user permissions of several tables. I figured 
out that if I submit the query
SELECT relacl FROM pg_catalog.pg_class WHERE relname = 'tablename';
I get the permissions but for the table name in all schemas and not only 
the one I'm interested in. Then I took a look at psql's source and I 
found the query for figuring out the permissions on a table in the 
describe.c file 
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/bin/psql/describe.c?rev=1.133). 
Unfortunately if I try to submit it, it gives me some error. It cannot 
recognize the "n.nspname" token and other similar errors. So can anyone 
help me with constructing an SQL query to figure out the permissions on 
a table in a specific schema? My other question is who has access to the 
pg_catalog.* tables? Is it true that every user can examine them? And 
are these tables per database or shared across PgSQL? Is is true that 
every user can check if he/she has access to a particular table and 
examine the ACL string? And how can I determine if a user can change 
permissions for other users?

Kind regards,
gamehack



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

* Re: Table permissions
  2006-03-26 20:34 Table permissions Milen Dzhumerov <gamehack@gmail.com>
@ 2006-03-26 23:10 ` Peter Eisentraut <peter_e@gmx.net>
  2006-03-27 15:43   ` Re: Table permissions Milen Dzhumerov <gamehack@gmail.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Peter Eisentraut @ 2006-03-26 23:10 UTC (permalink / raw)
  To: pgsql-admin; +Cc: Milen Dzhumerov <gamehack@gmail.com>

Milen Dzhumerov wrote:
> Unfortunately if I try to submit it, it gives me some
> error.

You need to post your exact input and the exact output.  Otherwise we're 
just guessing.

> My other
> question is who has access to the pg_catalog.* tables?

Everybody.

> And are these tables per database
> or shared across PgSQL?

Most of them are per database, only a few of them are shared.

> Is is true that every user can check if 
> he/she has access to a particular table and examine the ACL string?

Yes.

> And how can I determine if a user can change permissions for other
> users?

You can check the grant options available to the user.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/



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

* Re: Table permissions
  2006-03-26 20:34 Table permissions Milen Dzhumerov <gamehack@gmail.com>
  2006-03-26 23:10 ` Re: Table permissions Peter Eisentraut <peter_e@gmx.net>
@ 2006-03-27 15:43   ` Milen Dzhumerov <gamehack@gmail.com>
  0 siblings, 0 replies; 8+ messages in thread

From: Milen Dzhumerov @ 2006-03-27 15:43 UTC (permalink / raw)
  To: pgsql-admin

Peter Eisentraut wrote:
> Milen Dzhumerov wrote:
>   
>> Unfortunately if I try to submit it, it gives me some
>> error.
>>     
>
> You need to post your exact input and the exact output.  Otherwise we're 
> just guessing.
>
>   
>> My other
>> question is who has access to the pg_catalog.* tables?
>>     
>
> Everybody.
>
>   
>> And are these tables per database
>> or shared across PgSQL?
>>     
>
> Most of them are per database, only a few of them are shared.
>
>   
>> Is is true that every user can check if 
>> he/she has access to a particular table and examine the ACL string?
>>     
>
> Yes.
>
>   
>> And how can I determine if a user can change permissions for other
>> users?
>>     
>
> You can check the grant options available to the user.
>
>   
I just worked out the query which does the job and wanted to post it so 
if anyone wants in the future can refer to this thread. Here's the query:

SELECT pg_catalog.pg_class.relacl AS permissions FROM 
pg_catalog.pg_class WHERE pg_catalog.pg_class.relname = 'table_name' AND 
pg_catalog.pg_class.relnamespace IN (SELECT pg_catalog.pg_namespace.oid 
FROM pg_catalog.pg_namespace WHERE pg_catalog.pg_namespace.nspname = 
'schema_name');

Kind regards,
gamehack



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


end of thread, other threads:[~2006-03-27 15:43 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-11-22 10:39 table permissions MG <makgab@freemail.hu>
2001-11-24 03:06 ` Chad R. Larson <chad@eldocomp.com>
2001-11-24 22:46 ` Ian Barwick <barwick@gmx.net>
2001-11-25 17:01 ` Ian Barwick <barwick@gmx.net>
2001-11-26 14:52 ` Andrew G. Hammond <drew@xyzzy.dhs.org>
2006-03-26 20:34 Table permissions Milen Dzhumerov <gamehack@gmail.com>
2006-03-26 23:10 ` Re: Table permissions Peter Eisentraut <peter_e@gmx.net>
2006-03-27 15:43   ` Re: Table permissions Milen Dzhumerov <gamehack@gmail.com>

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