abonander opened a new issue, #37690:
URL: https://github.com/apache/doris/issues/37690

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Version
   
   (Unknown; not mentioned in original report.)
   
   ### What's Wrong?
   
   This issue is forwarding the following bug report: 
https://github.com/launchbadge/sqlx/issues/3335
   
   SQLx is a SQL client for the Rust programming language, supporting the MySQL 
protocol among others. The user is apparently having issues with prepared 
statements because SQLx is expecting the `COM_STMT_PREPARE_OK` packet to be at 
least 12 bytes, but Doris is returning a packet with fewer bytes. 
   
   I assume Doris is omitting the `warning_count` field, which the current 
documentation for the MySQL client/server protocol shows is optional: 
https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_com_stmt_prepare.html
   
   ### What You Expected?
   
   It is unclear exactly when the MySQL authors made the `warning_count` field 
optional, but this wasn't always the case.
   
   As recently as MySQL 8.0.31, the `warning_count` field was shown as 
non-optional: 
https://web.archive.org/web/20221126145800/https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_com_stmt_prepare.html
   
   While SQLx should be updated to accept a packet of 10 bytes, the issue is 
thus: [if Doris wants to advertise as being compatible with MySQL client 
5.7](http://web.archive.org/web/20240711202105/https://doris.apache.org/docs/db-connect/database-connect/#mysql-client),
 COM_STMT_PREPARE_OK should _always_ be at least 12 bytes: 
http://web.archive.org/web/20140424072016/http://dev.mysql.com:80/doc/internals/en/com-stmt-prepare-response.html
   
   ### How to Reproduce?
   
   I'd surmise that this can only occur when preparing a statement that takes 
zero parameters and returns zero columns, as otherwise the response packet 
should always be larger than 12 bytes (unless the 
`CLIENT_OPTIONAL_RESULTSET_METADATA` capability is set? The description is 
rather confusing).
   
   Reproducing should be as simple as sending a `COM_STMT_PREPARE` packet for 
such a statement, e.g.:
   
   ```sql
   INSERT INTO foo (bar) VALUES ('baz'):
   ```
   
   and observing the `COM_STMT_PREPARE_OK` response.
   
   ### Anything Else?
   
   This is all the context I have. cc @groobyming for details.
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to