Re: Problem with function & trigger

Поиск
Список
Период
Сортировка
От Carlo Vitolo
Тема Re: Problem with function & trigger
Дата
Msg-id 3B4A1C9C.A1A06DD4@ilrspa.com
обсуждение исходный текст
Ответ на Problem with function & trigger  (Carlo Vitolo <carlino@ilrspa.com>)
Список 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 по дате отправления:

Предыдущее
От: "Josh Berkus"
Дата:
Сообщение: Re: PGAccess/pgplsql Blues
Следующее
От: juerg.rietmann@pup.ch
Дата:
Сообщение: select only the first record