Expression index with function based on current_user?

From: Fredrik Olsson <fredrik(dot)olsson(at)treyst(dot)se>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Expression index with function based on current_user?
Date: 2006-02-08 11:26:24
Message-ID: 43E9D560.5000404@treyst.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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?

// Fredrik Olsson

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2006-02-08 11:53:08 Re: Expression index with function based on current_user?
Previous Message lrotger 2006-02-08 10:36:05 Re: Actual expression of a constraint