-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
ShardingSphere incorrectly handles table INFORMATION_SCHEMA
for H2Database 2.X
#15327
Comments
This sql is to load tables and columns from database. |
This leads to a topic I don't understand. If I need to fetch a class from H2Database in JUnit, how do I get the version, artifactId, groupId of the corresponding component of the class? Does this require a specific Maven plugin? |
I think we can use mock() currently, and test it yourself. |
|
You are very patient and I admire your ability to keep track of issues! |
|
I just carry my comments from the PR: The H2 database is the substitute for test only of MySQL, and version 1.x is the explicit dependency. So it is unnecessary to judge the major database version. To sum up, what is the proposal to upgrade H2 version from 1.x to 2.x? |
|
Bug Report
For English only, other languages will not accept.
Before report a bug, make sure you have:
Please pay attention on issues you submitted, because we maybe need more details.
If no response anymore and we cannot reproduce it on current information, we will close it.
Please answer these questions before submitting your issue. Thanks!
Which version of ShardingSphere did you use?
5.1.0
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-JDBC
Expected behavior
This Issue is an addition to #14617. The expected result is a normal integration of ShardingSphere JDBC 5.1.0 with H2database 2.X. I provide a reproducible Example Source at the end .
Actual behavior
ShardingSphere incorrectly handles table
INFORMATION_SCHEMA
for H2Database 2.X. When the SpringBoot project started, ShardingSphere executed the wrong SQL. Log as followsReason analyze (If you can)
H2 Database 2.X changes the structure of the table
INFORMATION_SCHEMA
, and it behaves normally on H2 Database 1.X. Also give you relevant information. @jeremie1112I honestly don't know why the
select
statement is used instead of partly using theDatabaseMetaData
class to handle metadata needed in ShardingSphere JDBC. Related to #11994 ?Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
The executed SQL is
SELECT TABLE_CATALOG, TABLE_NAME, COLUMN_NAME, DATA_TYPE, TYPE_NAME, ORDINAL_POSITION FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_CATALOG=? AND TABLE_SCHEMA=? AND TABLE_NAME IN ('user') ORDER BY ORDINAL_POSITION
Example codes for reproduce this issue (such as a github link).
I provide a minimal reproduction sample. Just execute the startup class directly. https://github.com/linghengqian/shardingsphere-h2-test
The text was updated successfully, but these errors were encountered: