dbeaver: Confirm dangerous query execution doesn't work when there's a RETURNING clause in a DELETE statement

System information:

  • Operating system (distribution) and version: Microsoft Windows [Version 10.0.22000.556]
  • DBeaver version: 22.0.1.202203181646
  • Java version: openjdk version “17.0.2” 2022-01-18

Connection specification:

  • Database name and version: PostgreSQL 14.1 (Debian 14.1-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
  • Driver name: org.postgresql:postgresql:42.2.5
  • Do you use tunnels or proxies (SSH, SOCKS, etc)? No

Describe the problem you’re observing:

The dangerous query execution confirmation doesn’t work when a DELETE statement has a RETURNING clause

Steps to reproduce, if exist:

Turn on the “Confirm dangerous query execution” feature:

image

Then create a table like this:

create table t (id int, a int);

Then run this statement:

delete from t returning *;

It executes without a prompt. The problem doesn’t affect UPDATE statements. The following statement produces a prompt:

update t set a = 1 returning *;

The prompt being:

image

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

Thank you @lukaseder . I have added support for the OUTPUT clause to the INSERT, DELETE and UPDATE statement. This should make those statements parsable and help to trigger the warning in DBeaver.

@E1izabeth: Please do let me know, when anything else was needed. I have attached a Snapshot JAR including the PR again. Unfortunately I can not merge the PR myself, but I would write an e-mail to the Project Owner @wumpz.

jsqlparser-4.5-SNAPSHOT.zip

Should be fixed by PR https://github.com/JSQLParser/JSqlParser/pull/1528 I have attached JSQLParser 4.4 + PR 1528, it should be sufficient to just replace the JAR file. jsqlparser-4.5-SNAPSHOT.zip

Greetings.

Currently, JSQLParser does not support the RETURNING for DELETE statements, although I will see what I can do about.

For future reference, the recent SQL Syntax Diagrams of JSQLParser: http://217.160.215.75:8080/jsqlformatter/_static/JSqlParserCC.xhtml#Delete

I keep that up-to-Date.