thswlsqls opened a new issue, #40065:
URL: https://github.com/apache/shardingsphere/issues/40065

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   master @ 7712a28fffe
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   Both
   
   ### Expected behavior
   For `DROP TABLE "MySchema".t_order`, the supported SQL checkers receive the 
`MySchema` schema, which the binder already resolved.
   
   ### Actual behavior
   The checkers receive the default schema (e.g. `public`), so sharding DDL 
checkers validate table existence against the wrong schema (false 
`NoSuchTableException` / `TableExistsException`).
   
   ### Reason analyze (If you can)
   - `SupportedSQLCheckEngine.getCurrentSchema()` calls 
`getTablesContext().getSchemaName().map(database::getSchema)`; 
`ShardingSphereDatabase.getSchema(String)` looks up with `QuoteCharacter.NONE`.
   - Under the default `metadata-identifier-case-sensitivity=DATABASE`, 
PostgreSQL/openGauss (lower-case) and Oracle (upper-case) policies miss a 
mixed-case schema on an unquoted lookup, so the engine falls back to the 
default schema.
   - `ShardingDropTableSupportedChecker`, `ShardingCreateTableSupportedChecker` 
and `ShardingCreateIndexSupportedChecker` then use that schema.
   - #38653 added `TablesContext#getIdentifierSchemaName()` and migrated 
`SchemaRefreshUtils`, but not this engine (context: closed #38391).
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   1. PostgreSQL database with schema `"MySchema"` containing a sharding table 
`t_order`.
   2. Execute `DROP TABLE "MySchema".t_order`.
   
   ### Example codes for reproduce this issue (such as a github link).
   N/A
   
   


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