mirror of
https://github.com/postgres/postgres.git
synced 2025-07-05 07:21:24 +03:00
array_length() function, and for SQL compatibility also cardinality()
function as a special case. This version still has the suspicious behavior of returning null for an empty array (rather than zero), but this may need a wholesale revision of empty array behavior, currently under discussion. Jim Nasby, Robert Haas, Peter Eisentraut
This commit is contained in:
@ -386,3 +386,12 @@ select string_to_array('1|2|3', NULL);
|
||||
select string_to_array(NULL, '|');
|
||||
|
||||
select array_to_string(string_to_array('1|2|3', '|'), '|');
|
||||
|
||||
select array_length(array[1,2,3], 1);
|
||||
select array_length(array[[1,2,3], [4,5,6]], 0);
|
||||
select array_length(array[[1,2,3], [4,5,6]], 1);
|
||||
select array_length(array[[1,2,3], [4,5,6]], 2);
|
||||
select array_length(array[[1,2,3], [4,5,6]], 3);
|
||||
select cardinality(array[1,2,3]);
|
||||
select cardinality(array[[1,2,3], [4,5,6]]);
|
||||
select c, cardinality(c), d, cardinality(d) from arrtest;
|
||||
|
Reference in New Issue
Block a user