SQLSTATE 0A000 ERROR Class 0A: Feature Not Supported

feature_not_supported set-returning functions are not allowed in WHERE — 0A000

PostgreSQL error "set-returning functions are not allowed in WHERE" (SQLSTATE 0A000): what it means, common causes, and how to fix it.

PG 12, 13, 14, 15, 16, 17, 18 Official docs
Last reviewed May 2025 Grounded in source

Diagnostic Queries

Symptoms

A set-returning function (SRF) was used in a WHERE clause, which is not allowed. PostgreSQL raises SQLSTATE 0A000 (feature_not_supported).

  • An SRF (e.g. generate_series, unnest) appeared in WHERE.
  • SRFs belong in FROM, not in row-filtering predicates.
  • Common when filtering against expanded sets.

What the server log shows

ERROR:  set-returning functions are not allowed in WHERE

Why PostgreSQL raises this — what the manual says

As Section 9.25 Set Returning Functions explains:

A set-returning function was placed where only a scalar value is allowed, such as a WHERE or HAVING clause or an aggregate argument; set-returning functions are permitted in the SELECT list or in the FROM clause (as a table function), so rewrite the query using a LATERAL join or a subquery in FROM.

A WHERE predicate must evaluate to a single boolean per candidate row. A set-returning function produces multiple rows, which has no defined meaning as a row filter, so PostgreSQL rejects it with 0A000.

Common causes

  • Calling unnest()/generate_series() directly in WHERE.
  • Trying to filter membership against an expanded set inline.

How to fix it

  1. Move the SRF to the FROM clause (e.g. a LATERAL join) and filter on its output.
  2. Use = ANY(array) or IN (subquery) for membership tests.
  3. Rewrite to join against the expanded set.

Related & next steps

Reference: PostgreSQL 18 — Set Returning Functions.

Was this helpful?