DBeaver Documentation

DOWNLOAD pdf

SQL Code Editor

Overview

The SQL Code Editor within DBeaver's SQL Editor provides you with advanced functionalities for SQL script management. This includes displaying problem markers, automatic closing of quotes and brackets, semantic analysis, and more. This article explores the settings of the SQL Code Editor, focusing on how they enhance the Script panel's behavior and ensure efficient management of your SQL code.

Configuring SQL Code Editor settings

To configure the SQL Script panel behavior, navigate to Window -> Preferences -> Editors -> SQL Editor -> Code Editor.

Further sections provide descriptions of the SQL Script panel settings.

Miscellaneous settings

Setting Description
Folding enabled Use folding in SQL scripts.
Smart caret positioning in SQL identifiers Respects underscore and other identifier parts to navigate with cursor.
Mark occurrences of word under cursor Mark occurrences of current word in the current SQL file.
Mark occurrences of the selected word Mark occurrences of the selected word in the current SQL file.
Show problem markers Shows individual problem markers near the failed queries and highlights the problematic segment of it in the editor. If disabled, selects the problematic segment in the editor.

Query analysis settings

Setting Description
Enable semantic analysis Highlight anything treated as table or column name and resolve all the aliases and table names according to FROM clauses.
Read database table/columns for semantic analysis May be an expensive operation. Validate all the table and column names with respect to real database objects.

This option is only available when Enable semantic analysis is activated.
  • The Enable semantic analysis feature highlights column names, their aliases, table names, and schema names.

    In instances where a selection list item is absent from the FROM clause, it is indicated with a red highlight.

    For example, the column b.id in the following SQL script will be highlighted, indicating it is missing from the FROM clause, thereby pinpointing a potential issue within the script.

  • The Read database table/columns for semantic analysis feature extends to verifying the existence of database objects. If an object referenced in the script does not exist or is not recognized in the database metadata, it is marked with a highlight.

    For example, if a script attempts to query a nonexistent column Biography as shown below, it will be highlighted to indicate that the column does not exist in the current database context:

Auto close settings

Setting Description
Single quotes Automatically closes a single quote mark with another single quote when the first one is typed.
Double quotes Automatically closes a double quote mark with another double quote when the first one is typed.
Brackets Automatically closes a bracket with the corresponding closing bracket when the first one is typed.

Auto format settings

Setting Tooltip Description
Convert keyword case Auto-convert keywords to upper/lower case on enter.
Extract SQL from source code On source code paste will remove all source language elements like quotes, +, \n, etc.