All rules

Style

postgresql/snake-case-column-name

Require snake_case column names.

  • Type suggestion
  • Recommended warn
  • Fixable no

Why this matters

Same rationale as `snake-case-table-name`: quoted `"CamelCol"` forces every caller to quote-match the name, while unquoted `CamelCol` is silently lowercased to `camelcol`.

Examples

Incorrect

Incorrect
CREATE TABLE t ("CamelCol" INT);

Correct

Correct
CREATE TABLE t (camel_col INT);
Correct
CREATE TABLE t (CamelCol INT); -- folded to camelcol

Configure it

// eslint.config.js
import postgresql from "eslint-plugin-postgresql";

export default [
  {
    files: ["**/*.sql"],
    languageOptions: {
      parser: postgresql.configs.recommended.languageOptions.parser,
    },
    plugins: { postgresql },
    rules: {
      "postgresql/snake-case-column-name": [
        "warn",
        {
          allow: [],
        },
      ],
    },
  },
];

Options

allow string[] default: []
Column names to exempt from the rule (e.g. `id`, `createdAt` for an existing schema mid-migration).
Try this rule

Edit the SQL — only snake-case-column-name is enabled.

Pre-filled with the first incorrect example. Toggle off in the rule shelf to see how the diagnostic disappears.

0 errors 0 warnings parse 0ms · rules 0ms
Diagnostics

No issues found.

2 rules enabled.

Rule under test snake-case-column-name — plus no-syntax-error as a safety net.
eslint-plugin-postgresql

An ESLint plugin that lints .sql files with real PostgreSQL grammar and a curated set of best-practice rules.

© 2026 eslint-plugin-postgresql contributors Built on libpg-query · PostgreSQL 17