Re: abs() does not exists..

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: mazzo <jambo(at)aruba(dot)it>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: abs() does not exists..
Date: 2001-06-12 22:11:42
Message-ID: Pine.LNX.4.30.0106130009150.756-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

mazzo writes:

> Hi all..i'm trying to create a trigger that fires before i insert a value into a column and if the value i insert is negative, it will change it to positive...
> I was trying with:
>
> create trigger postv before insert on my_table for each row execute procedure abs (column);
>
> But this doesn't seem to work and gives me the error i wrote in the subject...

Trigger procedures and regular functions cannot be mixed. You need to
write a special procedure that takes the old value and alters it to your
liking. See programmer's guide how to write trigger functions. PL/pgSQL
is probably best.

> Sorry if i post here but i looked on deja.com but i didn't find anything..

There are mailing list archives on the postgresql.org site and at
geocrawler.com.

--
Peter Eisentraut peter_e(at)gmx(dot)net http://funkturm.homeip.net/~peter

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Steve Micallef 2001-06-12 23:00:33 Unique rows without a key
Previous Message Stephan Szabo 2001-06-12 22:09:57 Re: abs() does not exists..