[MDEV-19203] Better way to update sql_mode Created: 2019-04-07  Updated: 2019-08-25

Status: Open
Project: MariaDB Server
Component/s: None
Fix Version/s: None

Type: Task Priority: Major
Reporter: Olaf van der Spek Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

In guides, you often see things like:
Get current mode: SHOW VARIABLES LIKE sql_mode";
Disable: mysql> SET sql_mode = '';
Enable: mysql> SET sql_mode = 'STRICT_ALL_TABLES'; (or STRICT_TRANS_TABLES).

https://stackoverflow.com/questions/38471018/when-to-use-strict-mode-in-mysql-or-mariadb

However, AFAIK, this doesn't just enable or disable strict mode, it affects all other sql mode bits as well.
A better way to toggle sql mode bits would be nice..
`set sql_mode_strict_all_tables = true` would be the ideal.



 Comments   
Comment by Sergei Golubchik [ 2019-04-07 ]

I'd rather suggest something like

SET sql_mode='STRICT_ALL_TABLES=on';

which is the syntax that @@optimizer_switch supports already, so it's consistent with existing behavior and already familiar to MariaDB users.

Comment by Olaf van der Spek [ 2019-06-20 ]

OK. What'd be the code for reading the current state?

Comment by Sergei Golubchik [ 2019-08-25 ]

SELECT @@sql_mode, similar to optimizer_switch.

But supporting set sql_mode_strict_all_tables = true also sounds like a very promising idea

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