Re: Trigger on 'create table' ?
От | Bruce Momjian |
---|---|
Тема | Re: Trigger on 'create table' ? |
Дата | |
Msg-id | 200210290223.g9T2Nuk04662@candle.pha.pa.us обсуждение исходный текст |
Ответ на | Trigger on 'create table' ? ("Bruce David" <brucedavid@bigfoot.com>) |
Список | pgsql-hackers |
Sorry, I can't think of any to have a view created automatically for every table creation. Interesting idea, though. I wonder if you could pass the CREATE string into a function that does the proper creation. --------------------------------------------------------------------------- Bruce David wrote: > All, > > I'm trying to implement row level security using PostgreSQL. I envision > having column on each and every table in the database that will contain a > discriminating value that determines if a given user is able to see that row > or not. Users do not directly access the database; they get at it only > through client applications. > > Is there a way to initially configure PostgreSQL such that each and every > time a 'create table foo....' command is executed that, something else would > happen instead? > > For example, > > CREATE TABLE weather ( > city varchar(80), > lo int, > hi int, > prcp real, > date date > ); > > would result in the following being executed automatically: > > CREATE TABLE t_weather ( > city varchar(80), > lo int, > hi int, > prcp real, > date date, > hidden_column int > ); > > CREATE VIEW weather AS > SELECT city, lo, hi, prcp, date > FROM t_weather; > > > How the view gets populated is another discussion entirely. > > But is there a way to set things up initially such that each 'create table' > command will exhibit the behavior described above? > > Thanks. > > -- > > Bruce > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania19073
В списке pgsql-hackers по дате отправления: