On Wed, Apr 01, 2009 at 07:40:16PM +0100, Greg Stark wrote: > The existing behaviour of returning NULL is the only "consistent" > choice since the correct value is "unknown". And one could argue that > it's easier to replace NULL with the correct value if the programmer > knows using coalesce than it is to replace either "" or {""}.
Couldn't a similar argument be applied for division by zero? Since it's not known whether the user wants to get a "divide by zero" exception or "infinity" PG should return NULL and punt the choice to the user. I think everybody would agree that this would be a bad thing to do! > But I'm > still leaning to thinking that using an arbitrary choice that at least > gets most users intentions is better. I'd agree; returning NULL and not forcing the user to make a choice is a bad design decision---the user doesn't need to put a coalesce in and hence their code will probably break in strange ways when they're not expecting it. Nobody suggest adding a third parameter to string_to_array, please! The general mantra that seems to apply here is "one good option is better than two bad ones". -- Sam http://samason.me.uk/ -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers