Rules#
There are 115 rules, all enabled by default except deprecated ones, which are not part of the active rule set.
Rules are divided into 8 categories:
- constraint: Rules for constraints
- general: Rules for best practices
- query: Rules for queries
- naming: Rules for naming
- schema: Rules for schema
- security: Rules for security
- typing: Rules for typing
- unsafe: Rules for unsafe schema migrations
constraint (CT)#
| Code | Name | Status | Auto-fixable |
|---|---|---|---|
| CT001 | cascade-update | ||
| CT002 | cascade-delete | ||
| CT003 | identity-generated-by-default | ||
| CT004 | remove-constraint | ||
| CT005 | duplicate-primary-key-column | ||
| CT006 | duplicate-unique-key-column |
general (GN)#
query (QY)#
| Code | Name | Status | Auto-fixable |
|---|---|---|---|
| QY001 | ordinal-number-group-by | ||
| QY002 | ordinal-number-order-by |
naming (NM)#
| Code | Name | Status | Auto-fixable |
|---|---|---|---|
| NM001 | invalid-index-name | ||
| NM002 | invalid-primary-key-name | ||
| NM003 | invalid-unique-key-name | ||
| NM004 | invalid-foreign-key-name | ||
| NM005 | invalid-check-constraint-name | ||
| NM006 | invalid-exclusion-constraint-name | ||
| NM007 | invalid-sequence-name | ||
| NM008 | implicit-constraint-name | ||
| NM009 | invalid-partition-name | ||
| NM010 | non-snake-case-identifier | ||
| NM011 | keyword-identifier | ||
| NM012 | special-character-in-identifier | ||
| NM013 | pg-prefix-identifier | ||
| NM014 | single-letter-identifier | ||
| NM015 | timestamp-column-without-suffix | ||
| NM016 | date-column-without-suffix |
schema (SM)#
| Code | Name | Status | Auto-fixable |
|---|---|---|---|
| SM001 | schema-unqualified-object | ||
| SM002 | disallowed-schema |
security (ST)#
| Code | Name | Status | Auto-fixable |
|---|---|---|---|
| ST001 | extension-whitelist | ||
| ST002 | procedural-language-whitelist | ||
| ST003 | security-definer-function-no-explicit-search-path | ||
| ST004 | security-definer-function-temp-schema-order | ||
| ST005 | security-definer-function-non-temp-schema |
typing (TP)#
| Code | Name | Status | Auto-fixable |
|---|---|---|---|
| TP001 | timestamp-without-timezone | ||
| TP002 | time-with-time-zone | ||
| TP003 | timestamp-with-timezone-with-precision | ||
| TP004 | char | ||
| TP005 | varchar | ||
| TP006 | money | ||
| TP007 | serial | ||
| TP008 | json | ||
| TP009 | integer | ||
| TP010 | smallint | ||
| TP011 | float | ||
| TP012 | xml | ||
| TP013 | hstore | ||
| TP014 | disallowed-data-type | ||
| TP015 | wrongly-typed-required-column | ||
| TP016 | numeric-with-precision | ||
| TP017 | nullable-boolean-field |