delete without where not possible

Answered

Yesterday i wanted to delete all content of a table and tried to execute the command "delete from <tablename>" in the console. Datagrip prohibit this with a warning "Unsafe query: 'Delete' statement without 'where' clears all data in the table". This is quite good to prevent accidentially deletion. But there is no option to overwrite this behavior. I have to add a dummy "where 1=1" to get the statement executed. I would like to see a dialog box instead with the warning and the possibility to delete the data anyway.

Kind Regards

Andreas

0
6 comments

You should see a yellow note at the bottom of console like this:

and here are 2 options - `execute` & `execute and suppress` (this one disables warning forever)

3

Thank you for the hint. I have missed the two links because in full screen mode the hint is a one liner and the links are placed on the far right. Also the contrast between foreground and background is a bit weak. I should better use a light color theme. There the contrast is better.

Kind Regards

Andreas

0

Hi Yuriy,

Is there a way of disabling this warning on a per query basis, rather than disabling the check forever?

i.e.

// @disableUnsafe
delete from table_name;

 

0

Steven Pearce,

There is no such an option. Could you file an issue in DataGrip YouTrack?

0

How to enable it back. If I click `execute and suppress` once.

1

Gwalke20, Preferences/Settings | Database | Query Execution | Show warning before running potentially unsafe queries.

2

Please sign in to leave a comment.