[postgis-users] UPDATE a value using trigger and ST_Contains

islanis at infomed.sld.cu islanis at infomed.sld.cu
Thu Feb 21 16:37:20 PST 2013


Hello list, i have a doubt, i have 2 tables
t1 and t2
and t1 has many t2, that's the constraint, but i need a trigger that  
update the value of the FK on the t2 table
cause i need to put the t1.gid on t2.munic_id automaticly when i  
update and insert, and i make this:


BEGIN

IF ST_Contains(t1.the_geom,ST_Centroid(NEW.the_geom)) = TRUE THEN
	NEW."munic_id" = t1.gid;
	END IF;

RETURN NEW;

END;

and i get this error


ERROR: falta una entrada para la tabla <<t1>> en la clausula FROM

please what it means??, i need help

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



--

Este mensaje le ha llegado mediante el servicio de correo electronico que ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema Nacional de Salud. La persona que envia este correo asume el compromiso de usar el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/


More information about the postgis-users mailing list