bgth
bgth

Reputation: 460

Stop execution of update query without where clause in Mariadb

Is it possible to set a rule in MariaDB to stop execution of update query without where clause? Like mariadb can stop insert of a record if it doesn't satisfy a foreign key constraint.

I am using Mariadb 10.1.

Upvotes: 0

Views: 297

Answers (1)

elenst
elenst

Reputation: 3987

The variable name is sql_safe_updates. It can be set at runtime on session or global level:

-- for the current session
SET SESSION sql_safe_updates = ON;

-- for future sessions
SET GLOBAL sql_safe_updates = ON;

Upvotes: 2

Related Questions