-
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
Throws TableNotFoundException when query the actual table directly. #34096
Comments
@gxgmy521 t_order_1 is part of t_order, and ShardingSphere does not allow them to be registered as two tables. If you need to query t_order_1, you can consider using SQL Hint pass-through, for specific reference: https://shardingsphere.apache.org/document/current/en/user-manual/common-config/sql-hint/#datasource-pass-through. |
My SQL is complex ( include multi-layer sub-query and need table shards) that ShardingSphere can not parse and rewrite, does the SQL Hint pass-through can work in this situation ? |
What is your database config? |
My real database config is complex, this is a demo config:
|
In vesion 5.1.2, when encountering an SQL that ShardingSphere cannot support, we use the ‘Single Table’ to bypass the problem. However, in the 5.5.0 version, this solution has been prohibited. What should I do? |
|
What is the good practice? |
Using logic table name |
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.5.0
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-JDBC
Expected behavior
I use the sharding datasource to direct access the actual table with the help of single table, here is the config example
I use the single table "ds_1.t_order1" In the SQL Due to the Sharding JDBC have some limitations (https://shardingsphere.apache.org/document/current/en/features/sharding/limitation/#sub-query-1)(for example do not support sub query without sharding key)
In version
5.1.2
it works well , however when I use5.5.0
version, it throws TableNotFoundException. My problem is:Actual behavior
In 5.5.0 version, it throw TableNotFoundException
Reason analyze (If you can)
The ShardingSphereDatabase class only save the logic table's metadata not the actual table ,so when I use the actual table directly,It can not find the table metadata and throw the exception.
Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
Example codes for reproduce this issue (such as a github link).
The text was updated successfully, but these errors were encountered: