From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | Marek Lewczuk <newsy(at)lewczuk(dot)com> |
Cc: | Lista dyskusyjna pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Needed function IF(expr, expr, expr) |
Date: | 2003-09-06 14:05:28 |
Message-ID: | Pine.LNX.4.44.0309061603250.1243-100000@peter.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
Marek Lewczuk writes:
> I'm moving out from MySQL to PostgreSQL and there are some function
> which are not supported in PG so I'm trying to write my own functions.
> Currently I have big problem with function IF(), below the description
> of this function from MySQL manual.
You cannot implement this kind of function, unless you want to create one
version for each data type combination. But consider replacing the IF()
function with the standard CASE expression:
CASE WHEN expr1 THEN expr_if_true ELSE expr_if_false END
Also note that in PostgreSQL there is a boolean type, and 0 and 1 are not
valid boolean values.
--
Peter Eisentraut peter_e(at)gmx(dot)net
From | Date | Subject | |
---|---|---|---|
Next Message | Bruno Wolff III | 2003-09-06 15:43:38 | Re: Needed function IF(expr, expr, expr) |
Previous Message | Marek Lewczuk | 2003-09-06 13:55:12 | Needed function IF(expr, expr, expr) |
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Treat | 2003-09-06 14:41:47 | Re: Notices for redundant operations |
Previous Message | Marek Lewczuk | 2003-09-06 13:55:12 | Needed function IF(expr, expr, expr) |