Re: Different views with same name for different users

From: "Harald Massa" <HaraldMassa(at)ghum(dot)de>
To: <pgsql-general(at)postgresql(dot)org>
Cc: "Darren Ferguson" <darren(at)crystalballinc(dot)com>
Subject: Re: Different views with same name for different users
Date: 2002-01-20 21:16:09
Message-ID: 014001c1a1f7$c1b2a930$0100a8c0@tog2
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I found (thank you, Holger Krug) a way to do the access-problem

create view pers as select * from totaldatabase
where case currentuser="userA" then beraterid in (1256,2523,2521,623,124)
else beraterid in (9123, 12312,12313) end

(or more case statements.)

But NOW there are 2 drawbacks

1.) INSERT and UPDATE became MUCH MORE complicated. I have defined rules (do
instead insert ....), but now partial inserts (only SOME columns of the
orignal table) do not work.

2.) there is some bad performance penality. If I do a
explain select * from totaldatabase
where case currentuser="userA" then beraterid in (1256,2523,2521,623,124)
else beraterid in (9123, 12312,12313) end
allways the sequential scan is used - also that only 2% of the rows are
visible. The Planner seems not to realise, that currentuser="userA" DOES NOT
change with each row.

I think I'll ask my question in another way again..

Thank you all,

HArald

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Harald Massa 2002-01-20 21:26:34 row based security ... was Different views with same name for different users
Previous Message Jochem van Dieten 2002-01-20 21:08:23 PL/pgSQL: dynamic tablename