Skip to content

MG28 — CREATE DOMAIN with a constraint is validated under a lock

Group: Migration safety · Auto-fixable: no

A CHECK or NOT NULL constraint on a DOMAIN is validated under a lock wherever the domain is used and is awkward to change later. Prefer a plain type plus table CHECK constraints.

bad: CREATE DOMAIN positive_int AS int CHECK (VALUE > 0);
good: -- use int, with a table CHECK (col > 0) constraint

Disable this rule in banshee.toml:

[lint]
exclude = ["MG28"]

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