Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support COMMENT and ATTRIBUTE for CREATE USER #24443

Closed
mjonss opened this issue May 6, 2021 · 2 comments
Closed

Support COMMENT and ATTRIBUTE for CREATE USER #24443

mjonss opened this issue May 6, 2021 · 2 comments
Labels
compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. type/compatibility type/feature-request Categorizes issue or PR as related to a new feature.

Comments

@mjonss
Copy link
Contributor

mjonss commented May 6, 2021

Feature Request

Is your feature request related to a problem? Please describe:

MySQL supports both COMMENT as well as ATTRIBUTE (json_object) for additional metadata per user account (like who created it, why does it exist etc.)

Describe the feature you'd like:
Add support for COMMENT 'free text comment' and ATTRIBUTE 'json_object' in:
CREATE USER [COMMENT '' | ATTRIBUTE '<json_object>']

Describe alternatives you've considered:
n/a, missing compatible feature with MySQL

Teachability, Documentation, Adoption, Migration Strategy:

When managing a lot of accounts, it is hard to understand why a specific account is for and if it really is needed, and by whom it was created and when.

@mjonss mjonss added the type/feature-request Categorizes issue or PR as related to a new feature. label May 6, 2021
@bb7133 bb7133 added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label May 7, 2021
@Tangruilin
Copy link
Contributor

If I'd like to fix it, what can I read as ref

@dveeden
Copy link
Contributor

dveeden commented Jul 7, 2023

Looks like this was done in #38201 / #38172

mysql> CREATE USER 'foo'@'%' COMMENT 'test';
Query OK, 0 rows affected (0.05 sec)

mysql> CREATE USER 'bar'@'%' ATTRIBUTE '{"reference": "https://example.com/tickets/000001"}';
Query OK, 0 rows affected (0.04 sec)

mysql> SHOW CREATE USER 'foo'@'%'\G
*************************** 1. row ***************************
CREATE USER for foo@%: CREATE USER 'foo'@'%' IDENTIFIED WITH 'mysql_native_password' AS '' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK PASSWORD HISTORY DEFAULT PASSWORD REUSE INTERVAL DEFAULT ATTRIBUTE '{"comment": "test"}'
1 row in set (0.01 sec)

mysql> SHOW CREATE USER 'bar'@'%'\G
*************************** 1. row ***************************
CREATE USER for bar@%: CREATE USER 'bar'@'%' IDENTIFIED WITH 'mysql_native_password' AS '' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK PASSWORD HISTORY DEFAULT PASSWORD REUSE INTERVAL DEFAULT ATTRIBUTE '{"reference": "https://example.com/tickets/000001"}'
1 row in set (0.01 sec)

mysql> SELECT TIDB_VERSION()\G
*************************** 1. row ***************************
TIDB_VERSION(): Release Version: v7.2.0
Edition: Community
Git Commit Hash: 9fd5f4a8e4f273a60fbe7d3848f85a1be8f0600b
Git Branch: heads/refs/tags/v7.2.0
UTC Build Time: 2023-06-27 15:04:42
GoVersion: go1.20.5
Race Enabled: false
Check Table Before Drop: false
Store: tikv
1 row in set (0.00 sec)

@dveeden dveeden closed this as completed Jul 7, 2023
@dveeden dveeden added type/compatibility compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) labels Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. type/compatibility type/feature-request Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

4 participants