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

MySQL interface sends SQLSTATE 00000 instead of HY000 for failed queries #50957

Closed
thbley opened this issue Jun 13, 2023 · 1 comment · Fixed by #73948
Closed

MySQL interface sends SQLSTATE 00000 instead of HY000 for failed queries #50957

thbley opened this issue Jun 13, 2023 · 1 comment · Fixed by #73948
Assignees
Labels
bug Confirmed user-visible misbehaviour in official release

Comments

@thbley
Copy link

thbley commented Jun 13, 2023

Server: docker image clickhouse/clickhouse-server:23.5-alpine
Client: mysql --version mysql Ver 8.0.33-0ubuntu0.22.04.2 for Linux on x86_64 ((Ubuntu))

Server config:

<clickhouse>
    <mysql_port>3306</mysql_port>
</clickhouse>
  1. I connect to clickhouse with a mysql client:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 17
Server version: 23.5.1.3174-ClickHouse 
  1. I execute an invalid query:
mysql> select foo bar;
ERROR 47 (00000): Code: 47. DB::Exception: Missing columns: 'foo' while processing query: 'SELECT foo AS bar', required columns: 'foo'. (UNKNOWN_IDENTIFIER) (version 23.5.1.3174 (official build))

=> the query failed, server response indicates error code 47 with SQLSTATE 00000.

  1. By definition, the first two characters of an SQLSTATE value indicate the error class (https://dev.mysql.com/doc/refman/8.0/en/error-message-elements.html). Class = '00' indicates success.

=> So many client libraries such as PHP's pdo_mysql treat the failed query as a successful query.

From my understanding of the MySQL documentation, "HY000" should be used instead of "00000", but I'm not a mysql core expert and the final decision is up to you.

@thbley thbley added the potential bug To be reviewed by developers and confirmed/rejected. label Jun 13, 2023
@thbley thbley changed the title MySQL engine sends SQLSTATE 00000 instead of HY000 for failed queries MySQL interface sends SQLSTATE 00000 instead of HY000 for failed queries Jun 13, 2023
@evillique evillique self-assigned this Nov 16, 2023
@qoega qoega added bug Confirmed user-visible misbehaviour in official release and removed potential bug To be reviewed by developers and confirmed/rejected. labels May 16, 2024
@thbley
Copy link
Author

thbley commented Dec 31, 2024

Thank You!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed user-visible misbehaviour in official release
Projects
None yet
3 participants