pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gulcin Yildirim <yildirim.gulcin88@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Stefan Sylla <stefansylla@gmx.de>
Cc: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Re: update column based on postgis query on anther table
Date: Wed, 17 Jul 2013 12:58:00 +0300
Message-ID: <F5092BB9-BC24-4B54-A7C3-1C16FD8C024A@gmail.com> (raw)
In-Reply-To: <317.1373952273@sss.pgh.pa.us>
References: <51E4B5A5.4040805@gmx.de>
	<317.1373952273@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>



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

> Stefan Sylla <stefansylla@gmx.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@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (5+ messages)

Message-ID: <F5092BB9-BC24-4B54-A7C3-1C16FD8C024A@gmail.com>
Permalink:  ../F5092BB9-BC24-4B54-A7C3-1C16FD8C024A@gmail.com/
Also on:    postgresql.org/message-id/F5092BB9-BC24-4B54-A7C3-1C16FD8C024A@gmail.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: yildirim.gulcin88@gmail.com, tgl@sss.pgh.pa.us, stefansylla@gmx.de
  Subject: Re: update column based on postgis query on anther table
  In-Reply-To: <F5092BB9-BC24-4B54-A7C3-1C16FD8C024A@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox