Re: rules on INSERT can't UPDATE new instance?
От | Louis-David Mitterrand |
---|---|
Тема | Re: rules on INSERT can't UPDATE new instance? |
Дата | |
Msg-id | 20000520154417.A5252@styx обсуждение исходный текст |
Ответ на | Re: rules on INSERT can't UPDATE new instance? (Bruce Momjian <pgman@candle.pha.pa.us>) |
Ответы |
Re: rules on INSERT can't UPDATE new instance?
|
Список | pgsql-general |
On Sat, May 20, 2000 at 07:35:38AM -0400, Bruce Momjian wrote: > > From the create_rule man page this example is offered: > > > > CREATE RULE example_5 AS > > ON INERT TO emp WHERE new.salary > 5000 > > DO > > UPDATE NEWSET SET salary = 5000; > > > > But what is "NEWSET"? Is it a keyword? > > It should be: > > CREATE RULE example_5 AS > ON INERT TO emp WHERE new.salary > 5000 > DO > UPDATE emp SET salary = 5000 > WHERE emp.oid = new.oid; > > Fixing now. But this doesn't work in PG 7.0: auction=> create table test (price float); CREATE auction=> create rule price_control AS ON INSERT TO test WHERE new.price > 100 DO UPDATE test SET price = 100 where test.oid= new.oid; CREATE 27913 1 auction=> INSERT INTO test VALUES (101); INSERT 27914 1 auction=> SELECT test.*; price ------- 101 (1 row) -- Louis-David Mitterrand - ldm@apartia.org - http://www.apartia.fr MACINTOSH == Most Applications Crash If Not The Operatings System Hangs
В списке pgsql-general по дате отправления: