I want to update table when her view is updated. I use postgresql/postgis.
I create view.
CREATE VIEW filedata_view
AS SELECT num, id, ST_TRANSFORM(the_geom,900913)
FROM filedata
And now when its updated i want to update TABLE with this data. But i heared that triggers cant be puted in VIEW. So how to do this?
Now i use this function
CREATE OR REPLACE FUNCTION update_table() RETURNS TRIGGER AS '
BEGIN
UPDATE filedata SET id=NEW.id, the_geom=ST_TRANSFORM(NEW.st_transform,70066) where num=NEW.num ;
END;
' LANGUAGE plpgsql;
its fine. But another problem. How to add trigger to view i do this
CREATE TRIGGER up_table AFTER UPDATE ON filedata_view
FOR EACH ROW EXECUTE PROCEDURE update_table ();
but get error
ERROR: "filedata_view" is not a table.
UPDATE
How to set column name AS SELECT num, id, ST_TRANSFORM(the_geom,900913)
if i use this i get columns : num
,id
and st_transform
. How to set third column's name to the_geom
?