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

   Issue Understanding: On ShardingSphere-JDBC 5.5.2 (Spring Boot 2.7.18, Java 
8), switching the data source from Oracle to openGauss causes 
TableNotFoundException: Table or view 't_platform' does not exist. The Single 
rule declares db0.t_platform, but metadata lookup
     happens under the public schema, while the table actually resides in 
qzone_self_dev (or a similarly named schema).
   
     Root Cause: ShardingSphere treats PostgreSQL/openGauss with explicit 
schema semantics and defaults to public when no schema is specified. Your 
Single rule lists db0.t_platform without a schema, and the JDBC URL does not 
set a default schema. During metadata loading
     ShardingSphere falls back to public, so it cannot find t_platform located 
in your custom schema, triggering the exception.
   
     Problem Analysis:
   
     - openGauss default search_path is "$user", public, but ShardingSphere 
relies on the configured default schema; when absent it becomes public.
     - Oracle doesn’t expose the same schema distinction, so the configuration 
works there; openGauss needs an explicit schema.
     - Without a schema prefix, Single rule relies on the data source’s default 
schema set via JDBC URL or session; you haven’t set it.
     - Confirm actual location: select schemaname, tablename from pg_tables 
where tablename='t_platform'; and show search_path; will show the table isn’t 
in public.
   
     Conclusion: This is a configuration gap rather than a ShardingSphere bug. 
Set the schema explicitly:
   
     1. Add ?currentSchema=qzone_self_dev to the JDBC URL (or options=-c 
search_path=qzone_self_dev,public) to ensure the correct default schema.
     2. Alternatively, run set search_path to qzone_self_dev,public; as a 
connection init statement.
     3. Moving tables into public would also work but is less typical; setting 
currentSchema is preferred.


-- 
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