Passing an array of arrays as parameter to a function
问题 A web application can send to a function an array of arrays like [ [ [1,2], [3,4] ], [ [], [4,5,6] ] ] The outer array length is n > 0 . The middle arrays are of constant length, 2 in this example. And the inner arrays lengths are n >= 0 . I could string build it like this: with t(a, b) as ( values (1, 4), (2, 3), (1, 4), (7, 3), (7, 4) ) select distinct a, b from t where (a = any(array[1,2]) or array_length(array[1,2],1) is null) and (b = any(array[3,4]) or array_length(array[3,4],1) is null