[postgis-users] PostGIS Trigger doesn't work

Nicolas Ribot nicolas.ribot at gmail.com
Mon Jan 28 08:33:51 PST 2013


Can you display the query that is executed by the trigger function ?
(RAISE NOTICE command is handy for that.)

Are the gid you are joining on valid in both tables ?

Nicolas


On 28 January 2013 17:24, Marcello Benigno <benigno.marcello at gmail.com>wrote:

> Hi Nicolas,
>
> No error message, just the field is not filled.
>
>
> Marcello Benigno
>
> Em 28/01/2013, às 12:48, Nicolas Ribot <nicolas.ribot at gmail.com> escreveu:
>
> Hi,
>
> Any error message ?
>
> Nicolas
>
>
> On 28 January 2013 16:11, Marcello Benigno <benigno.marcello at gmail.com>wrote:
>
>> Hello All,
>>
>> The trigger below don't works and I need that when a new pipeline
>> (adutoras) is inserted or updated, the procedure check what are the
>> municipalities (municipios) that intersects the pipes and put the names of
>> the municipalities inside the field "municipios_abastecidos".
>>
>> CREATE OR REPLACE FUNCTION topology_fields()
>> RETURNS "trigger" AS$$BEGIN
>> NEW.municipios_abastecidos:=(
>>                       SELECT string_agg(municipios.nome,', ')
>>                       FROM municipios, adutoras
>>                       WHERE ST_Intersects(adutoras.geom, municipios.geom)
>>                       AND adutoras.gid = NEW.gid
>>                     );RETURN NEW;END; $$
>> LANGUAGE 'plpgsql';
>>
>> CREATE TRIGGER fill_topology_fields
>> BEFORE INSERT OR UPDATE ON adutorasFOR EACH ROW EXECUTE PROCEDURE topology_fields();
>>
>>
>> Thanks in advance,
>> --
>> *Marcello Benigno B. de Barros Filho*
>> Prof. do Curso Superior de Tecnologia em Geoprocessamento - IFPB
>> Mestre em Ciências Geodésicas e Tecnologias da Geoinformação - UFPE
>> Doutorando em Tecnologia Ambiental e Recursos Hídricos - UFPE
>> http://profmarcello.blogspot.com
>> http://about.me/marcello.benigno
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at lists.osgeo.org
>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>>
>>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20130128/cf7bc7d1/attachment.html>


More information about the postgis-users mailing list