dbeaver / dbeaver/dbeaver

DECLARE right before SELECT breaks script execution, color syntax highlights and field proposals

Open
#22,905 7 comments 1 reaction 1 assignee Claimed by @E1izabeth View on GitHub
xf:sql editor xf:sql parser
Dominant language
Java
Stars
51.8k
Forks
4.4k
Avg merge
3d 8h
Merged PRs (30d)
188

Description

### Description

When writing a query that uses `DECLARE` variables, both color syntax highlighting and field proposals break. When adding a space below the `DECLARE`d variables, color syntax highlighting and proposals begin working again.

Example query:
```sql
DECLARE @start_date DATE = DATEADD(MONTH, -1, CURRENT_TIMESTAMP)
DECLARE @end_date DATE = CURRENT_TIMESTAMP
SELECT
e.first_name AS FirstName
, e.last_name AS LastName
, e.hire_date AS HireDate
FROM employee_table e
WHERE e.hire_date BETWEEN @start_date AND @end_date
```

### DBeaver Version

Community Edition 23.3.5.202402181738

### Operating System

Windows 11

### Database and driver

Microsoft JDBC Driver for SQL Server

### Steps to reproduce

1. Write a simple query.
2. Add a `DECLARE` statement and define a variable.
3. See that the new syntax highlights have stopped working and field proposals no longer appear.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.