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

2013-02-22 Thread Bruce Rindahl
I'm sorry - I only speak/read english but I think I know what you are trying to do. My table "tiles" is the same as your table t1 - a table of polygons. My table "temp" is the same as your table t2 - a table of points. Both tables have a field "rec" where the tile table has the unique rec i want i

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

2013-02-22 Thread islanis
i put t1 and t2 cause the really real names of the tables are long, but i put here the real situation, the upper table is this: --- CREATE TABLE "sigfre_cub_Adm_munic" ( gid serial NOT NULL, nombre character

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

2013-02-21 Thread Andy Colson
On 02/21/2013 08:53 PM, Andy Colson wrote: select t1.gid from t1 where ST_Contains(t1.the_geom,ST_Centroid(NEW.the_geom)) info NEW."munic_id"; oops. s/info/into/ -Andy double oops. The into goes first: select t1.gid into NEW."munic_id" from t1 where ST_Contains(t1.the_geom,ST_Cen

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

2013-02-21 Thread Andy Colson
select t1.gid from t1 where ST_Contains(t1.the_geom,ST_Centroid(NEW.the_geom)) info NEW."munic_id"; oops. s/info/into/ -Andy ___ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-

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

2013-02-21 Thread Andy Colson
On 02/21/2013 06:37 PM, isla...@infomed.sld.cu wrote: 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

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

2013-02-21 Thread islanis
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