How to restrict select from table with external validation?

From: "Vladimir A(dot) Petrov" <vap(at)infopac(dot)ru>
To: pgsql-general(at)postgresql(dot)org
Subject: How to restrict select from table with external validation?
Date: 2006-07-10 09:56:32
Message-ID: 44B22450.6040603@infopac.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello!

I have table like

CREATE TABLE stats
(
username varchar(256) NOT NULL,
"time" int8 NOT NULL,
duration int4 NOT NULL,
phonenumber varchar(20) NOT NULL,
and so on ...
)

I have function like

CREATE OR REPLACE FUNCTION auth("varchar", "varchar")
RETURNS bool AS '
...
' LANGUAGE 'plperlu' VOLATILE;

where first argument is username and second is password. This function
returns true if username and password validated successfully or false
otherwise.

I have a user which must do only selects from table "stats".

My questions is how to restrict access on table "stats" to this user in
way where this user will be able to select only limited set of columns
from table "stats" and only rows with usernames for which this user
knows correct passwords validated via auth() function call.

Any help will be appreciated.
--
Vladimir A. Petrov (aka vap) phone: (+7 8482) 420069
Infopac JSC. Head of the exploitation department. http://infopac.ru
_______________________________________________________________________
^[:wq ...sed libera nos a malo.

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-07-10 10:05:28 Re: Aim of --enable-thread-safety ?
Previous Message DANTE Alexandra 2006-07-10 09:47:06 Aim of --enable-thread-safety ?