On Thu, Apr 02, 2009 at 09:29:04AM -0700, Steve Crawford wrote: > Leif B. Kristensen wrote: > >Somehow this reminds me of the old "division by zero" problem. > > > >IMO, the proper way to handle this kind of anomaly would be to test if > >the length of the string is non-zero before submitting it to the > >string_to_array() function. > > Quite the opposite. Where division by zero is simply illegal This is just a matter of definitions; divide by zero is fine in lots of languages and no exception will be raised. The fact that you're saying it's "simply illegal" means that you've internalised the definition to such an extent that any alternative appears "simply illegal". It seems reasonable to assume that if, to pick an arbitrary choice, string_to_array returned a zero element set people would say it was "simply illegal" for it to do anything else. There are choices for either and a choice needs to be made or the situation should somehow be made impossible. > I would argue against a change to have string_to_array('',',') throw an > error. I'd agree, throwing an exception here doesn't seem useful. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general