Why this matters
Renaming a table is fast in the database but breaks every running app that still queries the old name. Keep the old table accessible via a view until callers are migrated, then drop it in a separate deploy.
Examples
Incorrect
ALTER TABLE legacy_users RENAME TO users;Correct
CREATE TABLE users (id BIGINT PRIMARY KEY);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/no-rename-table": "warn",
},
},
]; Options
Edit the SQL — only no-rename-table is enabled.
Pre-filled with the first incorrect example. Toggle off in the rule shelf to see how the diagnostic disappears.
Diagnostics
No issues found.
2 rules enabled.
Rule under test
no-rename-table — plus no-syntax-error as a safety net.