polardbx-sql icon indicating copy to clipboard operation
polardbx-sql copied to clipboard

Fix (issuse: #104) : Cast error when 'set password'

Open joeCarf opened this issue 2 years ago • 5 comments

Problems solved in this PR

issuse: https://github.com/ApsaraDB/galaxysql/issues/104

Changes proposed in this PR

Tests

  • [ ] Unit test
  • [ ] DML_DDL test

Release note

None

joeCarf avatar Dec 02 '22 13:12 joeCarf

@Oldbread3 PTAL:)

joeCarf avatar Jan 09 '23 14:01 joeCarf

Will this fix cause exception for statement like set password for yejr@'%' = password('xx'); ?

Oldbread3 avatar Jan 10 '23 06:01 Oldbread3

Amend use name at code path below might be the proper way to fix this issue. https://github.com/polardb/polardbx-sql/blob/ffd596b88044465c0bfdcda7d19a2882fe0acc89/polardbx-parser/src/main/java/com/alibaba/polardbx/druid/sql/dialect/mysql/parser/MySqlStatementParser.java#L6506

Oldbread3 avatar Jan 10 '23 06:01 Oldbread3

Amend use name at code path below might be the proper way to fix this issue.

https://github.com/polardb/polardbx-sql/blob/ffd596b88044465c0bfdcda7d19a2882fe0acc89/polardbx-parser/src/main/java/com/alibaba/polardbx/druid/sql/dialect/mysql/parser/MySqlStatementParser.java#L6506

when using statement set password for yejr@'%' = password('xx');, variable user is a MySqlUserName object, while using set password for yejr = password('xx'); statement, user is a SQLIdentifierExpr object.

should i just cast SQLIdentifierExpr to MySqlUserName in MysqlStatementParser.class (code path above) or or use if sentense just in code path below ? https://github.com/polardb/polardbx-sql/blob/55ca0c9a51df795e8ad6bed4ce58cdd2d0c70eb3/polardbx-server/src/main/java/com/alibaba/polardbx/server/handler/privileges/polar/PolarSetPasswordHandler.java#L77

joeCarf avatar Jan 11 '23 09:01 joeCarf

这个pr还不能合入嘛 @Oldbread3 @ZSYTY

joeCarf avatar Mar 09 '23 01:03 joeCarf