On Fri, Jan 13, 2012 at 5:27 PM, Craig Ringer <ringerc@ringerc.id.au> wrote:
> Oooh, that's clever. Nice!
>
> People say function overloading is no good ....
They do??
I wrote a similar set of functions to simplify a particular piece of
UI code. Three functions called 'str2int'; one takes varchar and
returns int, one takes int and returns int, and one takes bigint and
returns bigint. I can pass anything the UI works with through these,
and I have a guarantee that it'll compare as integer. (The varchar one
isn't quite the same as casting to int; it swallows errors and returns
0, because that's what we want to achieve.) Function overloading is
awesome!
ChrisA