dangmingyang opened a new issue, #38709: URL: https://github.com/apache/shardingsphere/issues/38709
## Bug Report **For English only**, other languages will not accept. Before report a bug, make sure you have: - Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues). - Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview). 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? ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy? 5.5.3 (ShardingSphere-Proxy, official `apache/shardingsphere-proxy` image). ### Expected behavior When a client issues `CREATE TEMPORARY TABLE` against the Proxy, ShardingSphere should **either**: 1. Fully support it end-to-end (create / insert / select within the same client session), **or** 2. Reject it with a clear, explicit error such as *"temporary tables are not supported by ShardingSphere-Proxy"*. What it should **not** do is throw an internal `NullPointerException`, leave the logical metadata in an inconsistent state, and return three different, mutually contradictory errors depending on how many times the statement is run. ### Actual behavior Steps and the exact errors observed (errors come from three different layers): **1) First run of `CREATE TEMPORARY TABLE` → internal NPE (kernel layer):** ``` SQL Error [30000] [HY000]: Unknown exception. More details: java.lang.NullPointerException: Cannot invoke "org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereTable.getName()" because "each" is null ``` The DDL actually executes on the backend connection (the temporary table is physically created — see step 2), but the **post-DDL metadata refresh** throws an NPE, which is wrapped as `UnknownSQLException` (`30000` / `HY000`). As a result the table is **never registered into ShardingSphere's logical metadata**. **2) Second run of the *same* `CREATE TEMPORARY TABLE` → native MySQL error:** ``` SQL Error [1050] [42S01]: Table 'test_temp' already exists ``` This is a **native MySQL error** (vendor code `1050`), passed through. The DDL reached a backend connection that still holds the temporary table created in step 1, so MySQL itself rejects it before the metadata-refresh step runs. **3) `INSERT` into the table → ShardingSphere logical-layer error:** ``` SQL Error [10002] [42S02]: Table or view 'test_temp' does not exist. ``` This is **ShardingSphere's own** `TableNotFoundException` (vendor code `10002`, not MySQL's native `1146`). Because step 1's metadata refresh failed, `test_temp` is absent from the logical metadata, so the `INSERT` is rejected during binding — **before any backend connection is acquired / before it ever reaches MySQL**. ### Reason analyze (If you can) ### 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). -- 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]
