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