mysql_user: column_case_sensitive default is set to true (#737)

* mysql_user: column_case_sensitive default is set to true

* Update plugins/modules/mysql_user.py

Co-authored-by: Laurent Indermühle <laurent.indermuehle@pm.me>

---------

Co-authored-by: Laurent Indermühle <laurent.indermuehle@pm.me>
This commit is contained in:
Andrew Klychkov 2025-09-16 07:56:19 +02:00 committed by GitHub
commit fed5f30203
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 9 additions and 9 deletions

View file

@ -0,0 +1,2 @@
breaking_changes:
- mysql_user - the ``column_case_sensitive`` argument's default value has been changed to ``true``. If your playbook expected the column to be automatically uppercased for your users privileges, you should set this to ``false`` explicitly (https://github.com/ansible-collections/community.mysql/issues/577).

View file

@ -182,12 +182,14 @@ options:
column_case_sensitive:
description:
- The default is C(false).
- The default is C(true).
- When C(true), the module will not uppercase the field names in the privileges.
- When C(false), the field names will be upper-cased. This is the default
- This feature was introduced because MySQL 8 and above uses case sensitive
fields names in privileges.
- The default changed from C(false) to C(true) in v4.0.0
type: bool
default: true
version_added: '3.8.0'
locked:
@ -484,7 +486,7 @@ def main():
resource_limits=dict(type='dict'),
force_context=dict(type='bool', default=False),
session_vars=dict(type='dict'),
column_case_sensitive=dict(type='bool', default=None), # TODO 4.0.0 add default=True
column_case_sensitive=dict(type='bool', default=True),
password_expire=dict(type='str', choices=['now', 'never', 'default', 'interval'], no_log=True),
password_expire_interval=dict(type='int', required_if=[('password_expire', 'interval', True)], no_log=True),
locked=dict(type='bool'),
@ -567,13 +569,6 @@ def main():
module.fail_json(msg="unable to connect to database, check login_user and login_password are correct or %s has the credentials. "
"Exception message: %s" % (config_file, to_native(e)))
# TODO Release 4.0.0 : Remove this test and variable assignation
if column_case_sensitive is None:
column_case_sensitive = False
module.warn("Option column_case_sensitive is not provided. "
"The default is now false, so the column's name will be uppercased. "
"The default will be changed to true in community.mysql 4.0.0.")
if not sql_log_bin:
cursor.execute("SET SQL_LOG_BIN=0;")

View file

@ -33,6 +33,7 @@
password: 'msandbox'
priv:
'mysql_user_column_case.t1': 'SELECT(a, B, cC, Dd)'
column_case_sensitive: false
- name: Mysql_user Column case sensitive | Assert user privileges are all caps
community.mysql.mysql_query:

View file

@ -103,6 +103,7 @@
name: '{{ user_name_3 }}'
priv:
'data3.test_table_issue99': 'SELECT (a, b), INSERT (a, b), UPDATE'
column_case_sensitive: false
register: result
- name: Priv dict | Assert that grant privs on columns is changed
@ -116,6 +117,7 @@
name: '{{ user_name_3 }}'
priv:
'data3.test_table_issue99': 'SELECT (a, b), UPDATE, INSERT (b, a)'
column_case_sensitive: false
register: result
- name: Priv dict | Assert that grants same privs with different order is not changed