Re: [HACKERS] [GENERAL] Needed function IF(expr, expr, expr)

2003-09-07 Thread Rod Taylor
> I don't feel that the anyelement in -> anyelement out mechanism is the > last word in polymorphism, though. Care to propose additional features > of the same kind? If you can find a way to describe the behavior you > want in terms of the function signature, it'd be worth considering ... For my

Re: [HACKERS] [GENERAL] Needed function IF(expr, expr, expr)

2003-09-07 Thread Tom Lane
Greg Stark <[EMAIL PROTECTED]> writes: > Hm. I wonder if there are cases of people using functions like this with > user-defined volatile functions depending on the function's side effects > happening the correct number of times. Or do volatile functions not get > inlined like this? SQL functions

Re: [HACKERS] [GENERAL] Needed function IF(expr, expr, expr)

2003-09-07 Thread Tom Lane
Rod Taylor <[EMAIL PROTECTED]> writes: >> Any comments on the UNKNOWN issue? It's not too late to change that for >> 7.4, if we have consensus that we should. > I would actually prefer to get UNKNOWN so I can apply my own default > type, but we're not even given the chance to resolve the unknown

Re: [HACKERS] [GENERAL] Needed function IF(expr, expr, expr)

2003-09-07 Thread Rod Taylor
> Any comments on the UNKNOWN issue? It's not too late to change that for > 7.4, if we have consensus that we should. I would actually prefer to get UNKNOWN so I can apply my own default type, but we're not even given the chance to resolve the unknown issue ourselves. CREATE OR REPLACE FUNCTION

Re: [HACKERS] [GENERAL] Needed function IF(expr, expr, expr)

2003-09-07 Thread Greg Stark
> However, as of 7.4, that problem is gone too. If you write the function > just as above (language sql, volatile, not strict) then the planner will > inline it and indeed what you get is a CASE. Watch this: Hm. I wonder if there are cases of people using functions like this with user-defined v

Re: [HACKERS] [GENERAL] Needed function IF(expr, expr, expr)

2003-09-06 Thread elein
If the function is defined with ANY* and you defer typing the arguments until the first reference then I think you will get what you want with the CASE statement. If the function is called if( x>y, x+1, y), the first reference is in the argument list and so should be typed there. But if you pas

Re: [HACKERS] [GENERAL] Needed function IF(expr, expr, expr)

2003-09-06 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > Marek Lewczuk writes: >> 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