Re: Problem with function & trigger

From: Carlo Vitolo <carlino(at)ilrspa(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Problem with function & trigger
Date: 2001-07-09 21:05:33
Message-ID: 3B4A1C9C.A1A06DD4@ilrspa.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Tom Lane wrote:

> Carlo Vitolo <carlino(at)ilrspa(dot)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!

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2001-07-10 04:19:43 Help! Failure of pgdump -a
Previous Message Dave Goldstein 2001-07-09 20:19:37 SQL Project