"Karl O. Pinc" <kop@meme.com> writes:
> I'd like to write:
> SELECT larger(colA, colB) FROM foo
> and am wondering the best way to go about it.
> Does somebody have a good solution? (I don't suppose there's
> something built-in that I'm missing?)
All the standard datatypes have built-in two-argument larger()
functions, though they're generally named something more obscure
than that; try \df *larger*. The MAX and MIN aggregates require
larger() and smaller() functions --- if you can't find the function
you want by name, look into pg_aggregate to see what the transition
function for the relevant aggregate is.
regards, tom lane