a1104321118 opened a new issue, #22824: URL: https://github.com/apache/shardingsphere/issues/22824
## 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? 5.1.0 ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy? ShardingSphere-JDBC ### Expected behavior select results contains the column which added just now. ### Actual behavior Not contains. ### Reason analyze (If you can) 1. org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource#contextManager this parameter cached the table scheam, column names and others, but when add a new column, it is not changed. Or is any config wrong in my code ? ```java public DataSource shardingDataSource() throws SQLException { Map<String, DataSource> dataSourceMap = new HashMap<>(1); String datasourceName = "ds0"; dataSourceMap.put(datasourceName, dataSource()); ShardingRuleConfiguration shardingRuleConfig = new ShardingRuleConfiguration(); shardingRuleConfig.setShardingAlgorithms(ShardingConfig.ALGORITHM_MAP); shardingRuleConfig.setTables(ShardingConfig.getAllConfig()); Properties properties = new Properties(); // properties.put("sql-show", "true"); ModeConfiguration modeConfiguration = new ModeConfiguration("Memory", null, true); return ShardingSphereDataSourceFactory.createDataSource(modeConfiguration, dataSourceMap, Collections.singletonList(shardingRuleConfig), properties); } ``` 2.org.apache.shardingsphere.driver.jdbc.core.resultset.ShardingSphereResultSetMetaData#getColumnCount ```java @Override public int getColumnCount() throws SQLException { if (sqlStatementContext instanceof SelectStatementContext) { if (hasSelectExpandProjections()) { // there will return n (not include the new column) return ((SelectStatementContext) sqlStatementContext).getProjectionsContext().getExpandProjections().size(); } // there will return n+1 (include the new column) return resultSetMetaData.getColumnCount(); } return resultSetMetaData.getColumnCount(); } ``` 3.org.apache.shardingsphere.infra.binder.segment.select.projection.impl.ShorthandProjection#actualColumns ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc. 0. create a new table, and query it.(Use Sharding-JDBC) 1. add a new column. 2. re-query it.(Use Sharding-JDBC) ### 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]
