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

From: Michal Taborsky <michal(at)taborsky(dot)cz>
To: Doug McNaught <doug(at)mcnaught(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Row-level security--is it possible?
Date: 2004-07-02 15:32:07
Message-ID: 40E57FF7.6010407@taborsky.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

--
Michal Taborsky
http://www.taborsky.cz

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Doug McNaught 2004-07-02 15:46:38 Re: Row-level security--is it possible?
Previous Message Alvaro Herrera 2004-07-02 15:26:45 Re: Row values