dbeaver / dbeaver/dbeaver

code completion: completion does not work for the correct SQL request

Open
#39,812 3 comments 0 reactions 0 assignees View on GitHub
external xf:sql parser
Dominant language
Java
Stars
51.8k
Forks
4.4k
Avg merge
3d 13h
Merged PRs (30d)
183

Description

### Description

I have the following request for my database (database schema will be attached below):

```sql
-- Напишите запрос, который покажет распределение активных смен по районам: название района, количество активных такси в нем, и список улиц, на которых они находятся (в виде строки через запятую).
select
d.district_name,
COUNT(distinct sh.shift_id) as active_taxi_count,
string_agg(distinct case when sh.shift_id is not null then s.street_name end, ',') as street_list
from
district d
left join street s on
d.district_name = s.district_name
left join shift sh on
s.street_id = sh.street_id
and sh.shift_end is null
group by
d.district_name;
```

For which DBeaver doesn't give correct auto completion.

Image

### DBeaver Version

DBeaver community 25.2.5.202511161745

### Operating System

Microsoft Windows 11 Pro 25H2

### Database and driver

PostgreSQL 15.14

PostgreSQL JDBC Driver 42.7.2

### Steps to reproduce

1. open this database
2. run SQL editor and open the attached script
3. try to use ctrl+space to get context help

expected result: auto completion should work correctly
actual result: auto completion works incorrectly, always suggests SQL's reserved words, but not tables and columns of my DB.

### Additional context

My database script attached:

[base.sql](https://github.com/user-attachments/files/23815625/base.sql)

Additional info:

It theams that the following aggrigate function expression, with the filter, triggers the problem:

`string_agg(distinct case when sh.shift_id is not null then s.street_name end, ',') as street_list`

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.