Rules, Select, Union
От | Itai Zukerman |
---|---|
Тема | Rules, Select, Union |
Дата | |
Msg-id | 87d7jmrmmu.fsf@matt.w80.math-hat.com обсуждение исходный текст |
Ответы |
Re: Rules, Select, Union
|
Список | pgsql-sql |
I'm doing this: CREATE TABLE data ( val int4 ); CREATE TABLE pos ( ) INHERITS ( data ); CREATE TABLE neg ( ) INHERITS ( data ); CREATE RULE data_to_pos AS ON INSERT TO data WHERE NEW.val > 0 DO INSTEAD INSERT INTO pos ( val ) VALUES ( NEW.val ); CREATE RULE data_to_neg AS ON INSERT TO data WHERE NEW.val < 0 DO INSTEAD INSERT INTO neg ( val ) VALUES ( NEW.val ); So far, I think, so good. (Though, sometimes it looks like the second rule is never triggered even though val < 0. The real application that this simple example comes from has a bunch of triggers, though, so it could be some weird interaction...) Now I want to do: CREATE RULE data_val AS ON SELECT TO data DO INSTEAD SELECT * FROM pos UNION SELECT * FROM neg; Can this be done? I'm not having much success... This is 7.0.2... -itai
В списке pgsql-sql по дате отправления: