Dynamic views/permissions

Поиск
Список
Период
Сортировка
От Raj Mathur
Тема Dynamic views/permissions
Дата
Msg-id 16087.45449.309496.281238@mail.linux-delhi.org
обсуждение исходный текст
Ответы Re: Dynamic views/permissions
Список pgsql-sql
I'm trying to permit users access to their own records in a database.
A sample would be:

create table logins
(       login char(8),       name char(32),       primary key (login)
);

When a login is added an SQL user is created simultaneously.  Now I
want the user to be able to view her own data:

create function userid() returns text as 'select current_user::text;' language sql;

create view loginview as select * from logins where logins.login=userid();

grant select on loginview to public;
[OR grant select on loginview to <userid>...]

However, a select * from loginview; doesn't return any rows.  Is what
I'm trying not possible at all, or am I just trying to implement it
wrong?

Regards,

-- Raju
-- 
Raj Mathur                raju@kandalaya.org      http://kandalaya.org/      GPG: 78D4 FC67 367F 40E2 0DD5  0FEF C968
D0EFCC68 D17F                     It is the mind that moves
 


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Chad Thompson"
Дата:
Сообщение: Re: Index scan never executed?
Следующее
От: Ian Barwick
Дата:
Сообщение: Re: Dynamic views/permissions