[MDEV-14429] sql_safe_updates in my.cnf not work Created: 2017-11-17  Updated: 2018-11-13  Resolved: 2018-10-15

Status: Closed
Project: MariaDB Server
Component/s: Configuration, Server
Affects Version/s: 10.0, 10.1, 10.2
Fix Version/s: 10.3.11

Type: Bug Priority: Minor
Reporter: Richard Stracke Assignee: Vladislav Vaintroub
Resolution: Fixed Votes: 0
Labels: upstream


 Description   

Hio,

set global sql_safe_updates=1;
set local sql_safe_updates=1;

works properly, but adding
sql_safe_updates=1 tigger this error

"unknown variable 'sql_safe_updates=1'"

Already reported years ago for MySQL 5.5 here:

https://bugs.mysql.com/bug.php?id=66536



 Comments   
Comment by Sergei Golubchik [ 2017-11-18 ]

workarounds: init-connect (per user), init-file (globally), safe-updates in [mysql] section of my.cnf

Comment by Richard Stracke [ 2017-11-21 ]

Both ....

init-connect (per user)
init-file (globally)

not work.

[mysqld]
 
init_connect='SET sql_safe_updates=on'
 
init_file='/etc/mysql/safeupdates.sql'

content of '/etc/mysql/safeupdates.sql' :

set global sql_safe_updates=on

restart service

MariaDB [(none)]> show variables like 'sql_safe%';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| sql_safe_updates | OFF   |
+------------------+-------+
1 row in set (0.00 sec)
 
MariaDB [(none)]> show variables like 'init%';
+---------------+----------------------------+
| Variable_name | Value                      |
+---------------+----------------------------+
| init_connect  | SET sql_safe_updates=on    |
| init_file     | /etc/mysql/safeupdates.sql |
| init_slave    |                            |
+---------------+----------------------------+
3 rows in set (0.00 sec

Comment by Elena Stepanova [ 2017-11-21 ]

Your init file is missing a semicolon, you should see an error in the error log if you check it.

For init-connect, apparently you're trying as root, it's not executed for super-users.

Comment by Julien Fritsch [ 2017-12-13 ]

serg any reason for the priority change, please?

Comment by Sergei Golubchik [ 2018-10-11 ]

Because Major is a "Major loss of function.", Minor is "Minor loss of function, or other problem where easy workaround is present.". This is the case where an easy workaround is present, right?

Anyway, this is a very simple issue to fix, so sure, let's fix it

Comment by Sergei Golubchik [ 2018-10-20 ]

It needs GET_BIT support from 10.3, so can only be added to 10.3. I've cherry-picked it into 10.3 and reverted from 5.5

Generated at Thu Feb 08 08:13:29 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.