Skip to content

AM07 — Set-operation branches select different column counts

Group: Ambiguity · Auto-fixable: no

UNION/EXCEPT/INTERSECT require every branch to project the same number of columns; otherwise Postgres rejects the query. Branches containing * are skipped because their width is not known without the schema.

bad: SELECT a, b FROM t UNION SELECT c FROM u
good: SELECT a, b FROM t UNION SELECT c, d FROM u

Disable this rule in banshee.toml:

[lint]
exclude = ["AM07"]

Or silence one line with -- noqa: AM07. See Linting.