CLion 2021.2 Help

SQL Dialects

This page lets you specify the SQL dialects (DBMS-specific versions of SQL) used in various scopes.

File, Project, and Global are scopes that define what dialect to be applied in the scope of a single file, a folder with SQL files that is attached to the project, or every SQL file that is opened in the IDE. If you do not set a dialect, the Generic dialect is applied. In this case, some dialect-specific features are not available: inspections that are specific for the dialect, code completion for the dialect. Also, each time you open a new file in the IDE you need to specify the applicable data source.

Project scope override the Global one. It means that if you set the Global dialect to MySQL and the Project dialect to MariaDB, all files outside the project scope will automatically receive the MySQL code assistance.

Overall, it is useful to specify the Global dialect if you work with a single DBMS (for example, PostgreSQL) and you want to activate code assistance that is specific for this DBMS. Otherwise, if you have two projects that use PostgreSQL and Oracle, it is better to specify the Project dialect for each project.

Change the SQL dialect in the editor

  • Right-click the editing area of the input pane and select Change Dialect (<current_dialect>). In the Change SQL Dialect window, select a dialect.

    Note that the selected dialect is applied to all the data sources that were created with the current driver. For example, let's say that you have several data sources that use the PostgreSQL driver. If you change the dialect to Greenplum in one console, all the consoles and data sources that use the PostgreSQL driver will switch to the Greenplum dialect.

    Change the SQL dialect in the editor

Disable syntax error highlighting

  • Right-click the editing area of the input pane, select Change Dialect, and select Generic SQL. The Generic SQL dialect supports completion and highlighting for SQL keywords, table and column names. Syntax error highlighting is disabled, that is all statements in a query console are shown as syntactically correct).

Dialect settings

Item

Description

Global SQL Dialect

The SQL dialect for all the .sql and .ddl files on your computer; may be redefined in narrower scopes - at the project level, and/or for individual files and directories.

Project SQL Dialect

The SQL dialect for all the .sql and .ddl files in your current project. If <None> is specified, the global SQL dialect is inherited.

Path / SQL Dialect

The SQL dialects for individual files and directories - if different from the global or project dialect.

If nothing is specified in this section, all the .sql and .ddl in your project inherit the project dialect, and all the files that are outside the project - the global dialect.

To specify a dialect for a file or directory, click Icons general add and select the file or directory in the dialog that opens. Then click Icons actions edit or the SQL Dialect cell, and select the dialect.

The dialects specified explicitly are shown in black. The inherited dialects (unless you close the dialog) are shown in gray italic.

Dialect options

When specifying a dialect, in addition to particular dialects, you can select:

  • <None> or <Clear>. As a result, a dialect from a higher level is inherited.

  • Generic SQL. The Generic SQL dialect supports completion and highlighting for SQL keywords, table and column names. Syntax error highlighting is disabled, that is all statements in a query console are shown as syntactically correct).

Example

Say, most of the SQL script files on your computer are for PostgreSQL. In the current project, you are developing the scripts for Oracle but in one of the directories in your project there are the scripts for MySQL. In such a situation, you'd specify:

  • Global SQL dialect: PostgreSQL

  • Project SQL dialect: Oracle

  • <PathToMySQLScriptsFolder>: MySQL

Last modified: 14 September 2021