PostgreSQL rules
Explore 16 dbLinter rules for PostgreSQL and PL/pgSQL code. Each rule explains the issue, identifies the minimum supported PostgreSQL version and provides examples of problematic code and a recommended fix.
Start with the highest-severity rules below, or browse the full list.
Most severe PostgreSQL rules
The highest-severity rules that apply to PostgreSQL.
- G-1080 Avoid using the same expression on both sides of a relational comparison operator or a logical operator. Blocker
- G-1920 Avoid syntax errors. Blocker
- G-2150 Avoid comparisons with NULL value, consider using IS [NOT] NULL. Blocker
- G-3110 Always specify the target columns when coding an insert statement. Blocker
- G-3115 Avoid self-assigning a column. Blocker
- G-3120 Always use table aliases when your SQL statement involves more than one source. Blocker
- G-3145 Avoid using SELECT * directly from a table or view. Blocker
- G-3190 Avoid using NATURAL JOIN. Blocker
All 16 PostgreSQL rules
-
G-0010 Always format database code consistently.Minor Maintainability
-
G-1080 Avoid using the same expression on both sides of a relational comparison operator or a logical operator.Blocker Maintainability
-
G-1910 Avoid using the NOSONAR marker.Info Maintainability
-
G-1920 Avoid syntax errors.Blocker Maintainability
-
G-1930 Avoid long parsing times.Info Maintainability
-
G-1940 Avoid long checking times.Info Maintainability
-
G-2150 Avoid comparisons with NULL value, consider using IS [NOT] NULL.Blocker Reliability
-
G-3110 Always specify the target columns when coding an insert statement.Blocker Reliability
-
G-3115 Avoid self-assigning a column.Blocker Maintainability
-
G-3120 Always use table aliases when your SQL statement involves more than one source.Blocker Maintainability
-
G-3130 Try to use ANSI SQL-92 join syntax.Major Maintainability
-
G-3145 Avoid using SELECT * directly from a table or view.Blocker Reliability
-
G-3180 Always specify column names instead of positional references in ORDER BY clauses.Major Reliability
-
G-3190 Avoid using NATURAL JOIN.Blocker Reliability
-
G-3192 Avoid joining tables with the USING clause.Blocker Reliability
-
G-3195 Always use wildcards in a LIKE clause.Blocker Maintainability
16 total
Related rule collections
- Trivadis PL/SQL & SQL guideline rules - Rules that implement the Trivadis coding guidelines.
- OWASP-related security rules - Rules that name an OWASP Top 10 risk category.
- Oracle APEX rules - Checks for APEX applications, pages, items and regions.
- Security rules - All rules in the Security quality area.
- Reliability rules - Rules that prevent bugs and failures at run time.
- Maintainability rules - Rules for code that is easy to read and change.
- Rules by quality area - Security, reliability and maintainability.
- Rules by severity - From Blocker to Info.
- Rule profiles - Essential to Extreme: which rules are checked.
- Rules by tag - Topics such as SQL, performance and naming.
- All rules - Search and filter the complete rule set.