From: | Hannu Krosing <hannu(at)skype(dot)net> |
---|---|
To: | Fredrik Olsson <fredrik(dot)olsson(at)treyst(dot)se> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Expression index with function based on current_user? |
Date: | 2006-02-08 12:14:57 |
Message-ID: | 1139400898.3658.2.camel@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Ühel kenal päeval, K, 2006-02-08 kell 12:26, kirjutas Fredrik Olsson:
> I have private tables such as this (Very simplified):
> CREATE TABLE private.t_foo (
> ...
> );
> REVOKE ALL ON private.t_foo FROM public;
>
> Different users have access to different data in the table, so I do
> this view:
> CREATE VIEW foo AS
> SELECT * FROM private.t_foo WHERE private.haveaccess();
> GRANT ALL ON foo TO public;
>
> Using rules I then make the view updatable (In reality views fetch and
> write data to multiple tables usually). This works fine, but I have some
> thought on performance in the future.
>
> The function private.haveaccess()'s result depends on the currently
> logged in user, is it still possible to create an expression index over
> that function?
No, but you probably can crete index on static function
user_has_access(username) and then use that func in
private.haveaccess()
------------
Hannu
From | Date | Subject | |
---|---|---|---|
Next Message | Q Beukes | 2006-02-08 12:34:29 | pg_hba.conf alternative |
Previous Message | Robert Bernier | 2006-02-08 12:10:26 | Re: Audio interview |