polardb / polardb/polardbx-sql

In the USER management operation, when the hostname is not specified, it cannot be automatically set to%

Open
#104 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.7k
Forks
337
PR merge metrics
No merged PRs in 30d

Description

mysql>create user yejr identified by 'xx';  -- hostname  is not specified, treated as%
Query OK, 0 rows affected (0.12 sec)

mysql>show grants for yejr;  -- hostname  is not specified, treated as%
+----------------------------------+
| GRANTS FOR 'YEJR'@'%'            |
+----------------------------------+
| GRANT USAGE ON *.* TO 'yejr'@'%' |
+----------------------------------+
1 row in set (1.45 sec)

mysql>set password for yejr = password('xx');  -- hostname  is not specified, errors raised
ERROR 3009 (HY000): [154bfc7d7e002000][172.17.0.6:58709][d3]class com.alibaba.polardbx.druid.sql.ast.expr.SQLIdentifierExpr cannot be cast to class com.alibaba.polardbx.druid.sql.dialect.mysql.ast.expr.MySqlUserName (com.alibaba.polardbx.druid.sql.ast.expr.SQLIdentifierExpr and com.alibaba.polardbx.druid.sql.dialect.mysql.ast.expr.MySqlUserName are in unnamed module of loader 'app')

mysql>set password for yejr@'%' = password('xx');
Query OK, 0 rows affected (0.06 sec)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the shown CREATE USER, SHOW GRANTS, and SET PASSWORD statements, comparing the hostname-omitted and explicit '%' forms. Trace the SQL handling for SET PASSWORD when the user has no hostname; done means the omitted-hostname form succeeds and behaves like the explicit '%' form.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, mysql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.