Skip to content

feat(checkers): add varchar_length#16

Merged
pirr merged 1 commit into
mainfrom
feat/checker-varchar-length
Apr 30, 2026
Merged

feat(checkers): add varchar_length#16
pirr merged 1 commit into
mainfrom
feat/checker-varchar-length

Conversation

@pirr

@pirr pirr commented Apr 30, 2026

Copy link
Copy Markdown
Owner

Flags 'varchar(N)' columns. In Postgres, varchar(N), varchar, and text all use identical storage — there's no performance benefit to a length cap. The cap is enforced as a write-time constraint, which is fine if you actually want it, but most varchar(N) columns are fossils carried over from MySQL/SQL Server habits where length actually matters. Bare 'varchar' (no length) and 'text' are not flagged.

Severity: info. Capped varchar isn't broken; teams sometimes use it deliberately. Run periodically rather than blocking PRs on it. Reports the actual length cap in extra['length'] so consumers can prioritize suspiciously round numbers (255, 100, etc.).

Tests: clean (text), clean (unbounded varchar), positive (varchar(255)), mixed (only the capped column flagged), dropped column ignored. 20/20 against PG 10/13/15/17.

Flags 'varchar(N)' columns. In Postgres, varchar(N), varchar, and text
all use identical storage — there's no performance benefit to a length
cap. The cap is enforced as a write-time constraint, which is fine if
you actually want it, but most varchar(N) columns are fossils carried
over from MySQL/SQL Server habits where length actually matters. Bare
'varchar' (no length) and 'text' are not flagged.

Severity: info. Capped varchar isn't broken; teams sometimes use it
deliberately. Run periodically rather than blocking PRs on it. Reports
the actual length cap in extra['length'] so consumers can prioritize
suspiciously round numbers (255, 100, etc.).

Tests: clean (text), clean (unbounded varchar), positive (varchar(255)),
mixed (only the capped column flagged), dropped column ignored. 20/20
against PG 10/13/15/17.
@pirr pirr self-assigned this Apr 30, 2026
@pirr pirr added the checkers label Apr 30, 2026
@pirr pirr merged commit 5a14e40 into main Apr 30, 2026
2 checks passed
@pirr pirr deleted the feat/checker-varchar-length branch April 30, 2026 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant