Re: Different views with same name for different users

Поиск
Список
Период
Сортировка
От Harald Massa
Тема Re: Different views with same name for different users
Дата
Msg-id 014001c1a1f7$c1b2a930$0100a8c0@tog2
обсуждение исходный текст
Ответ на Re: Different views with same name for different users  (Darren Ferguson <darren@crystalballinc.com>)
Список 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


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

Предыдущее
От: alavoor
Дата:
Сообщение: PostgreSQL Licence: GNU/GPL
Следующее
От: "Harald Massa"
Дата:
Сообщение: row based security ... was Different views with same name for different users