arrays_overlap function

Returns true if the intersection of array1 and array2 is not empty.

Syntax

arrays_overlap (array1, array2)

Arguments

  • array1: An ARRAY.

  • array2: An ARRAY sharing a least common type with array1.

Returns

The result is BOOLEAN true if there is overlap.

If the arrays have no common non-null element, they are both non-empty, and either of them contains a null element, NULL, false otherwise.

Examples

> SELECT arrays_overlap(array(1, 2, 3), array(3, 4, 5));
 true
> SELECT arrays_overlap(array(1, 2, NULL, 3), array(NULL, 4, 5));
 NULL