dble icon indicating copy to clipboard operation
dble copied to clipboard

Error when `sql_small_result`/`sql_big_result+distinct`/`distinctrow`

Open actiontech-bot opened this issue 7 years ago • 1 comments

Raised by: @FlyingMao Steps:

  1. Query: select sql_big_result distinct pad from sbtest1; Return:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS pad
FROM sbtest1
LIMIT 100' at line 1
  1. Query: select sql_small_result distinct pad from sbtest1 order by pad; Return: io.mycat.plan.common.exception.MySQLOutPutException:column distinct not found

actiontech-bot avatar Aug 25 '17 09:08 actiontech-bot

By @yanhuqing666

  1. distinctrow case should be fixed.
  2. Parser support only select distinct sql_small_result. When parsing select sql_small_result distinct column, distinct will be treated as column name, and column as alias name. The SQL will be treated as select sql_small_result distinct as column, which cause 1064 error. Solution: Usage should follow MySQL documentation.

actiontech-bot avatar Aug 25 '17 09:08 actiontech-bot