[MDEV-30056] Impossible to export column grants Created: 2022-11-21  Updated: 2022-12-02  Resolved: 2022-12-02

Status: Closed
Project: MariaDB Server
Component/s: Authentication and Privilege System
Affects Version/s: 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10
Fix Version/s: 10.3.38, 10.4.28, 10.5.19, 10.6.12, 10.7.8, 10.8.7, 10.9.5, 10.10.3

Type: Bug Priority: Critical
Reporter: Aurélien LEQUOY Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None
Environment:

Debian 11



 Description   

when we want export role from MariaDB, and when it use 'reserved key word' it's not possible to import these roles :

example :

mysql --skip-column-names --no-auto-rehash --silent --execute="SELECT CONCAT('SHOW GRANTS FOR ''',User,''';') FROM mysql.user WHERE is_role = 'Y'" | mysql --skip-column-names --no-auto-rehash | sed 's/$/;/g;1s/^/## Grants for Roles ##\n/' > /tmp/role-grants.sql

GRANT SELECT (segmentation, cms, order, idAccount, runRateAmount, sector) ON `pc_common_copy`.`accountsSalesForceData` TO 'role_devro01';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'order, idAccount, runRateAmount, sector) ON `pc_common_copy`.`accountsSalesForce' at line 1

Here the problem with ORDER but it's the same with other keysword.

The goal there, should be to encapsulate fields with back quotes.

GRANT SELECT (segmentation, cms, `order`, idAccount, runRateAmount, sector) ON `pc_common_copy`.`accountsSalesForceData` TO 'role_devro01';


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