Skip to content

CV04 — Use count(*) instead of count(1)/count(0)

Group: Convention · Auto-fixable: yes

count(1) and count(0) count rows exactly like count(*), which states the intent directly and is the idiomatic spelling. Rewrites the literal to *.

bad: SELECT count(1) FROM t
good: SELECT count(*) FROM t

Disable this rule in banshee.toml:

[lint]
exclude = ["CV04"]

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