Re: Problem with function & trigger - Mailing list pgsql-sql

From Carlo Vitolo
Subject Re: Problem with function & trigger
Date
Msg-id 3B4A1C9C.A1A06DD4@ilrspa.com
Whole thread Raw
In response to Problem with function & trigger  (Carlo Vitolo <carlino@ilrspa.com>)
List pgsql-sql
Tom Lane wrote:

> Carlo Vitolo <carlino@ilrspa.com> 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!





pgsql-sql by date:

Previous
From: "Josh Berkus"
Date:
Subject: Re: PGAccess/pgplsql Blues
Next
From: juerg.rietmann@pup.ch
Date:
Subject: select only the first record