Re: Row-level security--is it possible?

Поиск
Список
Период
Сортировка
От Doug McNaught
Тема Re: Row-level security--is it possible?
Дата
Msg-id 87u0wqwgwx.fsf@asmodeus.mcnaught.org
обсуждение исходный текст
Ответ на Re: Row-level security--is it possible?  (Michal Taborsky <michal@taborsky.cz>)
Список pgsql-general
Michal Taborsky <michal@taborsky.cz> writes:

> Doug McNaught wrote:
>> But why not create a "products_restricted" view that uses the
>> CURRENT_USER function to see who's running it?
>> CREATE VIEW products_restricted AS
>> SELECT * FROM products WHERE Producer_ID = get_producer_id(CURRENT_USER);
>> [CURRENT_USER returns a string, so you would need to map it to your
>> producer_id somehow.]
>
> This would work only for this case (limiting single producer to one
> user). But we want to have a bit more flexible system, so we'd be able
> define the restrictions freely (like "only producers 1 and 5 and price
> less than 100"). I'm sorry I did not mention this.

Have you looked into set-returning functions for this?  That would let
you basically put whever logic you need into the function.

-Doug

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

Предыдущее
От: Michal Taborsky
Дата:
Сообщение: Re: Row-level security--is it possible?
Следующее
От: Juan Jose Costello Levien
Дата:
Сообщение: Re: Row values