Re: abs() does not exists..

From: "Rob Arnold" <rob(at)cabrion(dot)com>
To: "Bruno Wolff III" <bruno(at)wolff(dot)to>, "Peter Eisentraut" <peter_e(at)gmx(dot)net>
Cc: "mazzo" <jambo(at)aruba(dot)it>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: abs() does not exists..
Date: 2001-06-13 23:42:42
Message-ID: 001801c0f462$8acd5a20$4901010a@canrion.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

How about a trigger/function that does this:

if val < 0 then val = val * -1

--rob

----- Original Message -----
From: "Bruno Wolff III" <bruno(at)wolff(dot)to>
To: "Peter Eisentraut" <peter_e(at)gmx(dot)net>
Cc: "mazzo" <jambo(at)aruba(dot)it>; <pgsql-general(at)postgresql(dot)org>
Sent: Wednesday, June 13, 2001 10:45 AM
Subject: Re: abs() does not exists..

> On Wed, Jun 13, 2001 at 12:11:42AM +0200,
> Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
> > 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...
>
> Couldn't you do this using a rule to update the table and a constraint on
> the table to prevent bad data from getting into the table without using
the
> rule?
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-06-14 00:35:48 Re: problem connecting from another host
Previous Message Nicolas Huillard 2001-06-13 23:12:57 VARCHAR to CIDR type cast : external function for 6.5