Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UzOUs-0004sV-2m for pgsql-sql@arkaria.postgresql.org; Wed, 17 Jul 2013 09:58:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1UzOUq-0001Hi-Ss for pgsql-sql@arkaria.postgresql.org; Wed, 17 Jul 2013 09:58:08 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UzOUp-0001Hb-Pc for pgsql-sql@postgresql.org; Wed, 17 Jul 2013 09:58:07 +0000 Received: from mail-ea0-x235.google.com ([2a00:1450:4013:c01::235]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UzOUm-0006nt-Fz for pgsql-sql@postgresql.org; Wed, 17 Jul 2013 09:58:06 +0000 Received: by mail-ea0-f181.google.com with SMTP id a15so941804eae.12 for ; Wed, 17 Jul 2013 02:58:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:mime-version:in-reply-to:content-type :content-transfer-encoding:message-id:cc:x-mailer:from:subject:date :to; bh=pvHre4UEO90W50fkSkaoPUp49tTE7RFjlxbMgiPT854=; b=DtL6K1s/UUrQi3iDzIA0bZRi8KG9tkIBdtEAIuwHxErcEIVo+UZXRSKbnI3li8CelW Re8Iu5Lk1OJZO+8kZZmOOW52ZQabB2UdS3nbBLWVOBFzoe70p5gYCAtzA/V1mGideOlD OXOXoRHflfgXRIuAhEVh8nX8tfrgDqiVNwqBSKpeOwt6xgXWsZwPYLgv49SDMmWA9SqH H90zwlMJppkpZkq3oxzLqvErEk7t+ltRFQjqAWC1jtX8AvYQbutiRwcOrnrE81K7zbDc h674l+yH0mqNFniF6NaIoXbRdAINFdDHzmICeEWmoxgC9GnL8WgKm8zEconlSPig3XXu oEEg== X-Received: by 10.14.204.137 with SMTP id h9mr5768390eeo.13.1374055083281; Wed, 17 Jul 2013 02:58:03 -0700 (PDT) Received: from [46.221.68.69] ([46.221.68.69]) by mx.google.com with ESMTPSA id i2sm9523087eeu.4.2013.07.17.02.58.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Jul 2013 02:58:02 -0700 (PDT) References: <51E4B5A5.4040805@gmx.de> <317.1373952273@sss.pgh.pa.us> Mime-Version: 1.0 (1.0) In-Reply-To: <317.1373952273@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Message-Id: Cc: Stefan Sylla , "pgsql-sql@postgresql.org" X-Mailer: iPhone Mail (10B350) From: Gulcin Yildirim Subject: Re: update column based on postgis query on anther table Date: Wed, 17 Jul 2013 12:58:00 +0300 To: Tom Lane X-Pg-Spam-Score: 0.9 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org Sent from my iPhone =C4=B0 On 16 Tem 2013, =C3=AEat 08:24, Tom Lane wrote: > Stefan Sylla writes: >> Now I want to use a trigger function to automatically update the column= =20 >> 'id_test1_poly' in tabel 'test1_point': >=20 >> /**/ >> create or replace function test1_point_get_id_test1_poly() returns=20 >> trigger as $$ >> begin >> new.id_test1_poly=3Dtest1_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=20 >> test1_point_get_id_test1_poly(); >=20 > 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. >=20 > regards, tom lane >=20 >=20 > --=20 > Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-sql --=20 Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql