Skip to content
HALOWERK

Codewerk

sql antipatterns

Tokenizes every statement with an own dialect-aware SQL lexer and parses it with node-sql-parser where possible. Rules follow sqlcheck (Apache-2.0, anti-patterns 3001 SELECT *, 3006 ORDER BY RAND, 3007 pattern matching, 3011 implicit columns, 3014 OR, 3015 UNION, 3016 DISTINCT & JOIN), the PostgreSQL 18 manual (= NULL comparison, expression indexes, OFFSET cost, cross joins, operator type resolution), the PostgreSQL wiki "Don't Do This" (NOT IN), MySQL 8.4 safe-updates and type conversion.

POST https://code.halowerk.com/v1/sql-antipatterns

Inputs

Fields of the published input schema
FieldTypeRequiredDescription
sqlstringNoOne or more statements separated by semicolons.
queriesarrayNoStatements in execution order, e.g. from a query log.
dialectstringNo
schema_ddlstringNoOptional CREATE TABLE statements for type-aware checks.
n_plus_one_thresholdintegerNo
large_offsetintegerNo
Show full input schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "sql": {
      "type": "string",
      "maxLength": 1000000,
      "description": "One or more statements separated by semicolons."
    },
    "queries": {
      "type": "array",
      "maxItems": 5000,
      "items": {
        "type": "string",
        "maxLength": 20000
      },
      "description": "Statements in execution order, e.g. from a query log."
    },
    "dialect": {
      "type": "string",
      "enum": [
        "postgresql",
        "mysql"
      ],
      "default": "postgresql"
    },
    "schema_ddl": {
      "type": "string",
      "maxLength": 1000000,
      "description": "Optional CREATE TABLE statements for type-aware checks."
    },
    "n_plus_one_threshold": {
      "type": "integer",
      "minimum": 2,
      "maximum": 1000,
      "default": 5
    },
    "large_offset": {
      "type": "integer",
      "minimum": 100,
      "maximum": 1000000000,
      "default": 10000
    }
  }
}

Open original schema

Published input example

{
  "sql": "SELECT * FROM users WHERE email = NULL;\nDELETE FROM sessions;"
}

Result & documentation

Machine-readable documentation of this hub

Source of this page: the published HALOWERK catalog. Updated: 2026-11-17 UTC.

More endpoints in this hub

All endpoints in this hub โ†’