terrymanu commented on issue #39885: URL: https://github.com/apache/shardingsphere/issues/39885#issuecomment-5754615611
Hi @waynesura, thanks for the detailed reproduction. This is a duplicate of an SQL binder bug present in 5.5.2 and already fixed by [#37914](https://github.com/apache/shardingsphere/pull/37914). Your trigger analysis is essentially correct, but the immediate failure is an empty bound database name rather than the CTE alias `a` itself. For an expression projection such as `1 AS code`, 5.5.2 propagates empty database/schema binding information to the qualified outer reference. `TablesContext` then records the empty database name, and `SelectStatementContext#getTableMapperRuleAttributes` attempts to resolve it, resulting in `UnknownDatabaseException`. PR #37914 filters empty database and schema bindings in `TablesContext`. The change is included in [ShardingSphere 5.5.3](https://github.com/apache/shardingsphere/releases/tag/5.5.3). Please upgrade to 5.5.3 or later and verify the same SQL. If it still fails, please provide the new version and stack trace so we can investigate the remaining path. Recommended labels: `type: duplicate`, `in: SQL bind`. We can close this issue as duplicate of #37914. -- 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]
