X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id A2A669DC877 for ; Mon, 6 Feb 2006 06:48:08 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30932-10 for ; Mon, 6 Feb 2006 06:48:10 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from ibox-server.openwired.net (77.Red-213-97-52.staticIP.rima-tde.net [213.97.52.77]) by postgresql.org (Postfix) with ESMTP id F1F789DC84C for ; Mon, 6 Feb 2006 06:48:05 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by ibox-server.openwired.net (Postfix) with ESMTP id EAEED2E01DE; Mon, 6 Feb 2006 11:36:35 +0000 (GMT) Received: from ibox-server.openwired.net ([127.0.0.1]) by localhost (ibox-server.openwired.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 23589-07; Mon, 6 Feb 2006 11:36:34 +0000 (GMT) Received: from [10.0.0.21] (unknown [10.0.0.21]) by ibox-server.openwired.net (Postfix) with ESMTP id 3E8352E01DD; Mon, 6 Feb 2006 11:36:34 +0000 (GMT) Message-ID: <43E72966.4090100@openwired.net> Date: Mon, 06 Feb 2006 11:48:06 +0100 From: =?ISO-8859-1?Q?Josep_Sanmart=ED?= User-Agent: Mozilla Thunderbird 1.0.5 (X11/20050711) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-1?Q?William_Leite_Ara=FAjo?= , pgsql-sql@postgresql.org Subject: Re: Trigger on a column References: <43E71A6C.6070104@openwired.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by I-Box de Openwired (www.openwired.com) Antivirus-Antispam at openwired.net X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.733 required=5 tests=[AWL=-0.418, RCVD_IN_WHOIS_INVALID=2.151] X-Spam-Score: 1.733 X-Spam-Level: * X-Archive-Number: 200602/45 X-Sequence-Number: 24055 Hi, readding around I just found this: The CREATE TRIGGER statement in PostgreSQL implements a subset of the SQL99 standard. (There are no provisions for triggers in SQL92.) The following functionality IS MISSING: * SQL99 allows triggers to fire on updates to specific columns (e.g., AFTER UPDATE OF col1, col2). * ..... Does anybody know if that's true on version postgresql (PostgreSQL) 8.1.2? Because I don't actually know from what version that sentence is. Thanks in advance William Leite Araújo wrote: > http://www.postgresql.org/docs/8.1/interactive/sql-createtrigger.html : > > CREATE TRIGGER -- define a new trigger > > > Synopsis > >CREATE TRIGGER /name/ { BEFORE | AFTER } { /event/ [ OR ... ] } > > ON /table/ [ FOR [ EACH ] { ROW | STATEMENT } ] > EXECUTE PROCEDURE /funcname/ ( /arguments/ ) > > > There is not a way to create column level trigger. If the trigger > don't block the insert/update/delete, you can try an "after trigger" > that do all insertions once. > > 2006/2/6, Josep Sanmartí >: > > Hi, > > My trigger's running on a table that works perfectly. This trigger > calls > a function that inserts or modifies a row of a different table. My > problem is that I need to optimize this trigger, and the only way > that > I've found is to fire the trigger when certain table fields are > modified. I do it like this: > > CREATE TRIGGER tr_barra_aps AFTER INSERT OR DELETE OR UPDATE OF status > ON am_access_point EXECUTE PROCEDURE f_barra_aps(); > > but I get this error: > ERROR: syntax error at or near "status" at character 62 > > The status field is correct. Can anybody help me? > > Thanks > > -- > Josep Sanmarti > Analista de Projectes > > OpenWired > Caballero 87 - Bajos > 08029 - Barcelona > Tel. 93 495 0990 > Fax. 93 419 4591 > > Openwired > Alejandro Villegas,29 > 28043 - MADRID - ESPAÑA > Teléfono: 91 300 51 09 > Fax: 91 300 28 13 > http://www.openwired.com > > > ---------------------------(end of > broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings > > > > > -- > William Leite Araújo -- Josep Sanmarti Analista de Projectes OpenWired Caballero 87 - Bajos 08029 - Barcelona Tel. 93 495 0990 Fax. 93 419 4591 Openwired Alejandro Villegas,29 28043 - MADRID - ESPAÑA Teléfono: 91 300 51 09 Fax: 91 300 28 13 http://www.openwired.com