Rules and conditions
| От | George Silva |
|---|---|
| Тема | Rules and conditions |
| Дата | |
| Msg-id | 9aa147370912081652y7e58058fsc37a12838c660ae5@mail.gmail.com обсуждение исходный текст |
| Ответы |
Re: Rules and conditions
|
| Список | pgsql-general |
Hello guys,
I can't seem to understand why a simples if is not working on the
creation of rules.
I tried both ways (am i missing something?):
Take a look:
CREATE OR REPLACE RULE instead_update AS ON UPDATE TO foo
DO INSTEAD
(
IF exists(SELECT 1 FROM versioning.foo_version_1 WHERE oid = new.oid)
= TRUE THEN
UPDATE versioning.foo_version_1 SET
oid = new.oid,
att1 = new.att1,
att2 = new.att2,
the_geom = new.the_geom,
status = 'UPDATE'
WHERE oid = new.oid;
ELSE
INSERT INTO versioning.foo_version_1 VALUES (NEW.*,'UPDATE');
END IF;
)
Any toughts?
Thanks
--
George R. C. Silva
Desenvolvimento em GIS
www.sextantegeo2.blogspot.com
В списке pgsql-general по дате отправления: