Skip to content

5.5.2 version HavingSegmentBinder not read the SubqueryTableSegment columns #36582

@LeavesGirl

Description

@LeavesGirl

Which version of ShardingSphere did you use?

5.5.2

Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

ShardingSphere-JDBC

Expected behavior

Actual behavior

Cause: org.apache.shardingsphere.infra.exception.kernel.metadata.ColumnNotFoundException: Unknown column 'pp.id' in 'where clause'.

Reason analyze (If you can)

codes in org.apache.shardingsphere.infra.binder.engine.statement.dml.SelectStatementBinder#bind parsed the having columns not using tableBinderContexts, it's supported in 5.4.1 version

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

SELECT
count( 0 )
FROM
(
SELECT
pp.NAME AS partnerName ...
FROM
parking_statistic_spot_order_amount psoa
LEFT JOIN parking_partner_spot pps ON pps.spot_id = psoa.spot_id
LEFT JOIN parking_partner pp ON pps.partner_id = pp.id
WHERE
psoa.statistic_date >= '2025-06-01'
AND psoa.statistic_date <= '2025-06-01'
GROUP BY
statistic_date,
pp.id
HAVING
pp.id IS NOT NULL
) table_count

Example codes for reproduce this issue (such as a github link).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions