terrymanu commented on issue #37581:
URL: 
https://github.com/apache/shardingsphere/issues/37581#issuecomment-3699291988

   Issue Understanding
   
     - Config is PostgreSQL style !SINGLE with main.outbox_dm_tables.*, 
main.db_sharding.*, main.non-existing, defaultDataSource: main. Expectation: 
other schemas (e.g., infrastructure) should route to main by default. When 
main.non-existing is removed, queries on infrastructure.qrtz_LOCKS fail with 
TableNotFoundException.
   
     Root Cause
   
     - Single-table loading is manual since 5.4.0; tables not listed under 
tables: are not auto-loaded, so binder sees them as nonexistent.
     - defaultDataSource only decides where CREATE TABLE for single tables 
lands; it does not auto-enroll existing tables.
     - The entries you listed cover only outbox_dm_tables and db_sharding 
schemas. infrastructure is not loaded, so qrtz_LOCKS is rejected.
     - main.non-existing (two segments) is parsed in PostgreSQL mode as 
“dataSource main, schema wildcard *, table=non-existing”, which effectively 
loads all schemas on main, so it appears to work—but it’s accidental, not 
intended behavior.
   
     Analysis
   
     - Official syntax (PostgreSQL) is three segments: ds.schema.table, 
ds.schema.*, ds.*.*, or *.*.*; see 
http://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/yaml-config/rules/single/
     - Because single-table metadata is not auto-loaded, any table not matched 
by the configured patterns (and not handled by other rules like 
sharding/encryption) triggers TableNotFoundException during bind.
     - What you’re seeing aligns with the design rather than a routing bug.
   
     Conclusion
   
     Configure explicit coverage for the schemas you want managed, e.g., add 
main.infrastructure.* or use main.*.*/*.*.* if you intend to load all single 
tables on main. Relying on defaultDataSource alone will not auto-load existing 
tables.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to