Joe Conway wrote:
Actually, consistent with my last post, I think array_upper() on a zero-element array should return NULL. A zero-element array has a defined lower bound, but its upper bound is not zero -- it is really undefined.
Just to clarify my response, this is what I propose: regression=# select array_upper('[2][1:]={{},{}}'::int[],1); array_upper ------------- 2 (1 row) regression=# select array_upper('[2][1:]={{},{}}'::int[],2) IS NULL; ?column? ---------- t (1 row) Joe ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match