pingcap / tidb

TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. Try AI-powered Chat2Query free at : https://www.pingcap.com/tidb-serverless/
https://pingcap.com
Apache License 2.0
37.07k stars 5.83k forks source link

`mediumtext` returns 0xfa(250) instead of (0xfd)253 #6120

Closed nanne007 closed 6 years ago

nanne007 commented 6 years ago

Please answer these questions before submitting your issue. Thanks!

  1. What did you do? If possible, provide a recipe for reproducing the error.

JDBC(version: 5.1.46) returns byte array(instead of string) for mediumtext type column in TiDB. But In MySQL, it returns string, which is natural.

I think the same behavior is also applied to tinytext and longtext, which may have big impacts on existed projects.

  1. What did you expect to see?

  2. What did you see instead?

  3. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?

git commit hash: daa866cdd48e4c0f0d1969bc9238e727a87c6813

alivxxx commented 6 years ago

Thanks for your feedback! PTAL @XuHuaiyu

nanne007 commented 6 years ago

After look through myql jdbc connector, I found that it caused by JOOQ using an interface which mysql connector has a flawed implementation.

https://github.com/mysql/mysql-connector-j/blob/9cc87a48e75c2d2e87c1a293b2862ce651cb256e/src/com/mysql/jdbc/ResultSetMetaData.java#L335 It use TEXT for non-binary blob, but not *TEXT for other non-binary blob types.

Maybe JOOQ should change to another interface, or maybe fix it in mysql connector. Whatever, it's not related to TiDB.