terrymanu commented on issue #37407:
URL:
https://github.com/apache/shardingsphere/issues/37407#issuecomment-3661000427
## Root Cause
- The merger builds a column-label index from backend
ResultSetMetaData#getColumnLabel and matches it against the parsed aggregate
column label; a mismatch triggers this exception.
- Default labels differ by database/driver when no alias is given: MySQL
often returns COUNT(1), PostgreSQL returns count, SQL Server drivers often
return an empty/anonymous label like (No column name).
- #23799 is tagged db: SQLServer and is the same label-mismatch pattern,
still open as an enhancement.
## Analysis
- Your stack shows the aggregate expression as (1), which aligns with the
anonymous label behavior commonly seen with SQL Server drivers. If you are on
SQL Server, this is very likely the same class of issue as #23799.
- If you are on another database, we need to know the database
type/version and what the driver actually returns for getColumnLabel(1) to
judge whether it’s a different label-compatibility gap.
- Current best practice: add an explicit alias to the aggregate (e.g.,
SELECT COUNT(1) AS cnt FROM t_order) to avoid driver-specific default label
differences.
## Conclusion
- If the backend is SQL Server, this aligns with #23799 (alias-less
aggregate label mismatch); please add an alias as a workaround.
- If the backend is different, please share: database type/version, JDBC
or Proxy, driver version, the actual value of
ResultSetMetaData#getColumnLabel(1), and the full stack trace. With that, we
can confirm whether it’s the same compatibility issue or a new one to fix.
--
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]