array_nulls
Read PG 18 manual ↗This controls whether the array input parser recognizes unquoted NULL as specifying a null array element.
- Type
- bool
- Context
- user
- Measured default
- on
- Unit
- —
- Metadata snapshot
- 18
Definition PG 18 manual
This controls whether the array input parser recognizes unquoted NULL as specifying a null array element. By default, this is on, allowing array values containing null values to be entered. However, PostgreSQL versions before 8.2 did not support null values in arrays, and therefore would treat NULL as specifying a normal array element with the string value “NULL”. For backward compatibility with applications that require the old behavior, this variable can be turned off.
Note that it is possible to create array values containing null values even when this variable is off.
Measured default history
| Version interval | Default |
|---|---|
| 9.0 – 19 | on |
Authored guidance from the GUC source snapshot; the version-specific manual above is the definition reference. View source ↗
How it works
Enables input of NULL elements in arrays. It can be changed at session scope, so different sessions may observe different behavior.
With the normal on value, an unquoted NULL token in an array input denotes a SQL null element; quoting it denotes the text 'NULL'. The off value restores pre-8.2 input behavior and exists only for migration of legacy clients.
Monitor and change array_nulls together with backslash_quote, escape_string_warning, standard_conforming_strings. Validate on the relevant server role and real workload, then use its user context to choose session change, reload, or restart; a historical boot default is not the current effective value.
Operational considerations
Keeping a compatibility switch permanently instead of fixing the client.
Testing in one session and deploying globally to unrelated applications.
Confusing parsing compatibility with data or security compatibility.
Forgetting to remove an override after the upgrade migration is complete.
Workload guidance
OLAP: Regression-test ETL, generated SQL, and old drivers, where parsing/quoting assumptions hide. Performance is rarely a reason to change this switch.
OLTP: Keep the modern default and repair legacy clients/SQL that depend on array_nulls. Test migration at session scope first; do not make a compatibility switch permanent cluster policy.
SMALL: Keep the default without a legacy requirement. If temporarily enabled, record owner, affected connections, and a removal date.
Version history 3
- PG 17 → 18changed
- PG 9.6 → 10changed
- PG 9.0 → 9.1changed
Related entries
Further reading
Definition snapshot: english-manuals:a5949eb0734df40fcbeb610e77c… · English manual source