> I'm loath to change just this one thing though. If we're going to > monkey with it, I think we should start by having a thought-through > proposal about the behavior of all the array functions for corner > cases like null arrays and empty arrays (cf recent discussion about > zero-dimensional arrays).
If those are the only corner cases, here's something to work with. Looking at http://www.postgresql.org/docs/8.3/interactive/functions-array.html, I'd propose that every one of those operators and functions should return NULL::(normal-return-type) if any of their operands are NULL, to be consistent with Section 9.2 and to differentiate from the empty- array cases below, and that logic should precede anything to do with empty arrays. As for empty arrays, the following additions to the logic: = true if both arrays are empty <> true if either array is empty but not both < true if left operand is empty and right is not > true if right operand is empty and left is not <= true if left operand is empty >= true if right operand is empty @> true if right operand is empty <@ true if left operand is empty && false if either array is empty || (both array-array cases) return other array if one is empty (if left is empty, return right, elsif right is empty, return left) || (both element-array cases) return ARRAY[element] if array is empty array_append return ARRAY[element] if array is empty array_cat return other array if one is empty (if left is empty, return right, elsif right is empty, return left) array_dims return results obtained by ignoring empty sub-arrays; if entire array is empty, return '' array_lower raise exception if array is empty (there are no dimensions to inquire about) array_prepend return ARRAY[element] if array is empty array_to_string return '' if array is empty array_upper raise exception if array is empty (there are no dimensions to inquire about) string_to_array return '' if left operand is '' Hope that's useful... Kev -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs