All rules

Style

postgresql/align-values

Align column values vertically inside multi-row `INSERT ... VALUES`.

  • Type layout
  • Recommended off
  • Fixable yes

Why this matters

Each tuple position is padded so that values share a consistent width across rows. Single-row `VALUES` lists are skipped — the rule only kicks in when there are multiple rows to align.

Examples

Incorrect

Incorrect
INSERT INTO t (a, b, c) VALUES
  ('GPT-5',                 1.25, CURRENT_TIMESTAMP),
  ('Claude',                5,    CURRENT_TIMESTAMP),
  ('Haiku',                 1,    CURRENT_TIMESTAMP);

Correct

Correct
INSERT INTO t (a, b, c) VALUES
  ('GPT-5',  1.25, CURRENT_TIMESTAMP),
  ('Claude', 5,    CURRENT_TIMESTAMP);

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/align-values": [
        "warn",
        {
          gap: 1,
        },
      ],
    },
  },
];

Options

gap integer (>= 1) default: 1
Minimum number of spaces between aligned tuple positions.
Try this rule

Edit the SQL — only align-values 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 align-values — 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