Re: update column based on postgis query on anther table

From: Gulcin Yildirim <yildirim(dot)gulcin88(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Stefan Sylla <stefansylla(at)gmx(dot)de>, "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: update column based on postgis query on anther table
Date: 2013-07-17 09:58:00
Message-ID: F5092BB9-BC24-4B54-A7C3-1C16FD8C024A@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Sent from my iPhone
İ
On 16 Tem 2013, îat 08:24, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Stefan Sylla <stefansylla(at)gmx(dot)de> writes:
>> Now I want to use a trigger function to automatically update the column
>> 'id_test1_poly' in tabel 'test1_point':
>
>> /**/
>> create or replace function test1_point_get_id_test1_poly() returns
>> trigger as $$
>> begin
>> new.id_test1_poly=test1_point_get_id_test1_poly(new.id);
>> return new;
>> end;
>> $$
>> language plpgsql volatile;
>> -- create trigger for function:
>> create trigger test1_point_get_id_test1_poly
>> after insert or update on test1_point for each row execute procedure
>> test1_point_get_id_test1_poly();
>
> I think you need that to be a BEFORE insert or update trigger. In
> an AFTER trigger, it's too late to affect the stored row.
>
> regards, tom lane
>
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Carla Goncalves 2013-07-17 15:29:47 Listing table definitions by only one command
Previous Message Stefan Sylla 2013-07-16 14:27:45 Re: SOLVED: update column based on postgis query on anther table