sqlx icon indicating copy to clipboard operation
sqlx copied to clipboard

Failed to execute the prepared statement in Doris

Open groobyming opened this issue 1 year ago • 5 comments

Bug Description

A clear and concise description of what the bug is. According to the MySQL Protocol, COM_STMT_PREPARE_OK does not necessarily require 12 bytes. 10 bytes is also acceptable. My question is, why must we require 12 bytes? @mehcode

Code: https://github.com/launchbadge/sqlx/blob/main/sqlx-mysql/src/protocol/statement/prepare_ok.rs image

MySQL protocol: https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_com_stmt_prepare.html#sect_protocol_com_stmt_prepare_response_ok image

Minimal Reproduction

A small code snippet or a link to a Github repo or Gist, with instructions on reproducing the bug.

Info

  • SQLx version: [0.7.4]
  • SQLx features enabled: [ "runtime-tokio-rustls", "macros", "chrono","mysql","postgres",]
  • Database server and version: [REQUIRED] (doris)
  • Operating system: [linux]
  • rustc --version: [1.7.9]

groobyming avatar Jul 08 '24 06:07 groobyming

When initially implementing this, we actually used the MariaDB documentation for the most part because it's more readable. It shows warning_count (i.e. num_warnings) to be non-optional: https://mariadb.com/kb/en/com_stmt_prepare/#com_stmt_prepare_ok

To be fair, MySQL's documentation didn't always show this, either: http://web.archive.org/web/20210519015430/https://dev.mysql.com/doc/internals/en/com-stmt-prepare-response.html

It appears to have changed sometime between then and when they migrated to their new docs site, because it appears in this version from November 2022: https://web.archive.org/web/20221126145800/https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_com_stmt_prepare.html

abonander avatar Jul 11 '24 20:07 abonander

I would consider this a bug in Doris because it reports compatibility with MySQL client 5.7 and later: https://doris.apache.org/docs/db-connect/database-connect#mysql-client

5.7 is definitely going to be expecting 12 bytes as well: http://web.archive.org/web/20140115165549/http://dev.mysql.com/doc/internals/en/com-stmt-prepare-response.html

abonander avatar Jul 11 '24 20:07 abonander

opened https://github.com/apache/doris/issues/37690

abonander avatar Jul 11 '24 20:07 abonander

@groobyming a minimal reproduction would be appreciated for the Doris bug report.

abonander avatar Jul 11 '24 20:07 abonander

@groobyming a minimal reproduction would be appreciated for the Doris bug report. @abonander Thank you for your reply and the issue you submitted. I will follow the fix progress of the doris community.👍

groobyming avatar Jul 13 '24 13:07 groobyming