It's good to hear this kind of discussion going on!
I solved my problem (for now) by creating a bunch of
overloaded LEAST and GREATEST functions, one for each
datatype. They only take two parameters, but that's
fine for what we're doing.
However, I ran into another, unrelated problem. I
created
> Um, what's wrong with MAX and MIN, exactly?
MIN and MAX are aggregate functions, LEAST and
GREATEST are not. See the examples on the following
table:
foo
A B
- -
1 4
2 3
3 2
> SELECT LEAST(a, b), GREATEST(a, b) FROM foo;
LEAST(a, b) GREATEST(a, b)
--- --
1 4
2
Hi,
I know the LEAST and GREATEST functions are not part
of standard SQL, but they sure were handy where I came
from (Oracle-land).
Has anyone written user-defined functions that do the
same thing?
Are there any plans to add these functions as part of
a future version Postgres?
Thanks,
-Stefan