View a markdown version of this page

default_array_search_null_handling - Amazon Redshift
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Amazon Redshift will no longer support the use of Python UDFs after June 30, 2026. We will start enforcing it in phases. For more information on the details of Python end of life and migration options, see the blog post that was published on June 30, 2025.

default_array_search_null_handling

Values (default in bold)

TRUE, FALSE

Description

Specifies the null handling behavior for array search operations. When default_array_search_null_handling is TRUE, NULL values are treated as valid elements that can be searched within arrays. When default_array_search_null_handling is FALSE, NULL key searches return NULL, and if the array contains NULL values with no match found, the search returns NULL.

Examples

SET default_array_search_null_handling to TRUE; -- ARRAY_CONTAINS: NULL search is allowed SELECT ARRAY_CONTAINS(ARRAY('red', NULL, 'green'), NULL); array_contains ---------------- t (1 row) -- ARRAY_POSITION: Array can contain NULLs SELECT ARRAY_POSITION(ARRAY('red', NULL, 'green'), 'blue'); array_position ---------------- -1 (1 row)
SET default_array_search_null_handling to FALSE; -- ARRAY_CONTAINS: NULL search is disabled SELECT ARRAY_CONTAINS(ARRAY('red', 'green'), NULL); array_contains ---------------- (1 row) -- ARRAY_POSITION: Array contains NULL but no match is found SELECT ARRAY_POSITION(ARRAY('red', NULL, 'green'), 'blue'); array_position ---------------- (1 row)