INSERT INTO users VALUES (1, 'ana@example.com'); puts the values into the table's columns in their current order. Nothing is lost today, but after a column is added it fails (PostgreSQL: INSERT has more expressions than target columns or a type error; MySQL: Column count doesn't match value count at row 1), and after columns are reordered it can quietly write values into the wrong ones. List the columns.
Why it happens
Seed files, fixtures and quick scripts skip the column list because it is shorter. The statement then encodes an assumption about the table's exact shape, which every migration can break.
How to fix it
Always name the target columns, so the statement keeps working when columns are added and fails clearly when one it uses is removed:
INSERT INTO users (id, email) VALUES (1, 'ana@example.com');How to stop it from happening again
VERICTO-060 · INSERT without explicit columns · Severity: Low · AST node: InsertStmt > Cols = NULL
The statement the rule reports
-- seed.sql
INSERT INTO users VALUES (1, 'ana@example.com');
Real CLI output
$ npx @vericto/vericto-cli@2.3.0 check --offline seed.sql
note: offline mode: 42 standard rules at default severities, engine 5.1.0. Custom rules, overrides, sensitive columns, allowlists and the audit trail apply online only.
• seed.sql MONITORED VERICTO-060 low
InsertStmt > Cols = NULL
fix: INSERT INTO users (col1, col2) VALUES ($1, $2)
0 blocked · 0 allowed · 0 flagged · 1 monitored (ruleset standard@engine-5.1.0 · mode: offline (engine 5.1.0, 42 standard rules, no workspace policy))
The CLI records it as MONITORED and exits with 0: it is a low-severity notice. With --fail-on any the job fails on these too.
The corrected version
-- seed.sql
INSERT INTO users (id, email) VALUES (1, 'ana@example.com');
$ npx @vericto/vericto-cli@2.3.0 check --offline seed.sql
note: offline mode: 42 standard rules at default severities, engine 5.1.0. Custom rules, overrides, sensitive columns, allowlists and the audit trail apply online only.
0 blocked · 1 allowed · 0 flagged · 0 monitored (ruleset standard@engine-5.1.0 · mode: offline (engine 5.1.0, 42 standard rules, no workspace policy))
Try it free, no account
The CLI checks your .sql files on your machine with the 42 standard rules: no sign-up, no API key, and no SQL leaves your computer. It is open source (AGPL-3.0-only).
npx @vericto/vericto-cli@2.3.0 check --offline migrations/
On every pull request
The vericto/check-sql GitHub Action (Apache-2.0) runs the same offline check on the .sql files a PR changes and annotates the findings on the PR. Save it as .github/workflows/vericto.yml:
on: pull_request
jobs:
vericto:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with: { fetch-depth: 0 }
- uses: vericto/check-sql@v1
with: { offline: true, upload-sarif: false }
At runtime, for AI agents
The SQL an AI agent writes never goes through a PR. The Vericto TCP proxy checks each statement between the application or agent and the database, and the MCP check_sql tool lets the agent check SQL before it runs it. Both use the runtime profile, which also blocks schema changes.
The AST condition in the engine
The rule is a deterministic predicate over the AST, in src/rules/evaluator.rs of the open source engine (AGPL-3.0-only), at this page's commit:
"VERICTO-060" => find(stmts, |s| {
s.kind == StatementKind::Insert && !s.insert_has_columns
})
.map(|s| {
let rel = s.relation.as_deref().unwrap_or("{table}");
let mut v = violation(
rule,
s,
Some(format!("INSERT INTO {rel} (col1, col2) VALUES ($1, $2)")),
);
v.ast_node_path = "InsertStmt > Cols = NULL".to_string();
v
}),
Frequently asked questions
Related rules
- VERICTO-040: INSERT INTO … SELECT without filter
- VERICTO-061: INSERT batch with more than 10k rows
- VERICTO-016: ALTER TABLE RENAME (table or column)