Received: from linuxbox.ilrspa.com ([194.243.125.130]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f69L5sa74539 for ; Mon, 9 Jul 2001 17:06:02 -0400 (EDT) (envelope-from carlino@ilrspa.com) Received: from ilrspa.com (carlino.ilrspa.com [194.243.125.138]) by linuxbox.ilrspa.com (8.11.0/8.8.7) with ESMTP id f69L5Xc04284; Mon, 9 Jul 2001 23:05:33 +0200 Message-ID: <3B4A1C9C.A1A06DD4@ilrspa.com> Date: Mon, 09 Jul 2001 23:05:33 +0200 From: Carlo Vitolo Reply-To: carlino@ilrspa.com X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.4-win4lin i686) X-Accept-Language: en MIME-Version: 1.0 To: Tom Lane CC: "pgsql-sql@postgresql.org" Subject: Re: Problem with function & trigger References: <3B46ED17.9F3EACA4@ilrspa.com> <29529.994534086@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200107/101 X-Sequence-Number: 3885 Tom Lane wrote: > Carlo Vitolo writes: > > This does not work. The error is ERROR: pg_atoi: error in "12.00": can't > > parse ".00" > > What PG version are you running? It seems to work fine for me in > current sources: > > Ver. 7.1.2 > > BTW, the way you are writing the functions seems bizarrely inefficient. > Why not just: > > CREATE FUNCTION "togliscar" () RETURNS opaque AS 'BEGIN > UPDATE magazzino > SET quantita = quantita - NEW.quantita > WHERE descrizione = NEW.descrizione; > RETURN NEW; > END; > ' LANGUAGE 'plpgsql'; > > regards, tom lane Yes is better thanks! You are right it works perfectly. It was my fault. I had another trigger on insert and this function used an incorrect type of variable. By the way. Is there a way to have an error message like "ERROR xxx in Function xxx "?. Bye!