Inspectopedia 2024.3 Help

Unused common table expression

Reports unused common table expressions (CTE) inside the query.

Example (PostgreSQL):

CREATE TABLE foo(a INT); WITH a AS (SELECT 1 AS x FROM foo) SELECT 1 + 2 FROM foo;

By using WITH, we create a temporary named result set with the name a, also known as a common table expression (CTE). But we do not use this CTE later in the code. The unused CTE is greyed out.

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

SqlUnusedCte
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | SQL

Last modified: 03 December 2024