Re: Checking Permissions with SQL

From: Christopher Sawtell <csawtell(at)xtra(dot)co(dot)nz>
To: "Joseph" <lters(at)mrtc(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Checking Permissions with SQL
Date: 2001-02-09 20:44:49
Message-ID: 01021009444900.11144@berty
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, 10 Feb 2001 00:17, Joseph wrote:
> How would I be able to check whether I have select,update,insert,etc
> permissions on a given table with an sql statement?
>
> I am working on a generic php interface that lists all or some tables
> and lets you edit them.
>
> I want to get away from the permisssion denied error that php gives me.

You have to GRANT whatever permissions are needed to the user the web
server run as. vis:-

grant select on school to nobody;
grant select on school_number_seq to nobody;

This enable the web server, which runs as 'nobody' to select and read from
the database.

school=# select relacl from pg_class where relname = 'school';
relacl
-------------------------------
{"=","chris=arwR","nobody=r"}
(1 row)

--
Sincerely etc.,

NAME Christopher Sawtell
CELL PHONE 021 257 4451
ICQ UIN 45863470
EMAIL csawtell @ xtra . co . nz
CNOTES ftp://ftp.funet.fi/pub/languages/C/tutorials/sawtell_C.tar.gz

-->> Please refrain from using HTML or WORD attachments in e-mails to me
<<--

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Paola Manzo 2001-02-09 20:54:44 Consulta
Previous Message Tiger Technologies 2001-02-09 20:33:37 Postmaster uses Large Amounts of Swap