Bug #99749 Modify user() and current_user() functions to allow ATTRIBUTE return
| Submitted: | 31 May 2020 16:50 | Modified: | 1 Jun 2020 9:47 |
|---|---|---|---|
| Reporter: | Brad Lanier | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: Security: Privileges | Severity: | S4 (Feature request) |
| Version: | 8.0.21 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | CURRENT_USER(), user ATTRIBUTE, user() | ||
[1 Jun 2020 9:47]
Georgi Kodinov
Thank you for the very reasonable feature request. We will consider implementing a variant of it.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.053 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: With the introduction of version 8.21, capability is added for a user ATTRIBUTE field containing a JSON object (see CREATE USER and ALTER USER). It would be useful to retrieve this ATTRIBUTE in a simple and straightforward manner using the user() and current_user() functions. This would also enable ANY of this information to be extracted and used in a single simple expression in both GENERATED columns and DEFAULT column expressions. How to repeat: Invoke user() or current_user() function. There is currently no option to return the ATTRIBUTE information. Suggested fix: Recommend the user() and current_user() functions be modified with an optional flag that, when set, would return both the USER/HOST information and ATTRIBUTE JSON object as a single JSON object. For example, invoking user(attribute_flag)with attribute_flag set would return a JSON object consisting of the USER and HOST keys prepended to any existing ATTRIBUTE JSON object. As an example, for a user jim@localhost with an ATTRIBUTE value of {"fname": "James", "lname": "Scott", "phone": "123-456-7890"}, invoking the user() function as user(1) would return {"USER": "jim", "HOST": "localhost", "fname": "James", "lname": "Scott", "phone": "123-456-7890"}. If no ATTRIBUTE exists for jim@localhost, then user(1) would return {"USER": "jim", "HOST": "localhost"}.