CONTAINS

Returns true if the specified element is found in the collection and false if not. Both arguments must be non-null, but the collection may be empty.

Behavior Type

Immutable

Syntax

CONTAINS(collection, val_to_test)

Supported Data Types

1D collections of any primitive type.

Example

=> SELECT CONTAINS(SET[1,2,3,4],2);
 contains
---------- 	
t
(1 row)
				
=>  SELECT CONTAINS(ARRAY[]::ARRAY[INT],1);
 contains
----------
 f
(1 row)

See Also