terrymanu commented on issue #38712:
URL: 
https://github.com/apache/shardingsphere/issues/38712#issuecomment-4555086065

   Hi @Tracy0725, thanks for reporting this.
   
   This is a duplicate issue. It is covered by the same `ColumnSegmentBinder` 
unparenthesized-function binding problem fixed by #38350. #38350 added 
`DialectFunctionOption`, and Oracle now includes `CURRENT_DATE` in its 
dialect-level unparenthesized function list, so the root cause is already 
covered on current `dev`.
   
   In ShardingSphere-JDBC 5.5.3, Oracle `CURRENT_DATE` was not recognized as an 
unparenthesized function that should skip column binding. It was therefore 
bound as a normal column and finally failed with `Unknown column 'CURRENT_DATE' 
in 'where clause'`. Please verify with a version that includes #38350. I 
suggest labeling this as `type: duplicate`, `in: SQL bind`, `db: Oracle`, and 
closing it as duplicate.
   
   The reply above is based on the analysis below; the detailed reasoning is 
kept here for reference and follow-up contributors.
   
   ### Problem Understanding
   
   - **Issue:** Oracle 19c + ShardingSphere-JDBC 5.5.3 fails in SQL bind when 
bare `CURRENT_DATE` is used in `WHERE` predicates against date columns.
   - **Topology:** JDBC + Spring Boot. Governance mode and registry/config 
center are not provided, but the stack trace is in `SQLBindEngine` / 
`ColumnSegmentBinder`, so topology does not affect the duplicate classification.
   - **Observed Evidence:** `OBS-1`, `OBS-2`, `OBS-3`, `OBS-4`, `OBS-5`, `OBS-6`
   - **OBS-1:** #38712 reports `shardingSphere JDBC 5.5.3 + springboot + oracle 
19c`, and the SQL uses `CURRENT_DATE <= ...` / `CURRENT_DATE >= ...` multiple 
times. Source: https://github.com/apache/shardingsphere/issues/38712
   - **OBS-2:** #38712 fails in `ColumnSegmentBinder.getColumnSegmentInfo` with 
`ColumnNotFoundException: Unknown column 'CURRENT_DATE' in 'where clause'`. 
Source: https://github.com/apache/shardingsphere/issues/38712
   - **OBS-3:** In tag `5.5.3`, `ColumnSegmentBinder` has a static skip list 
containing `SYSDATE`, `SYSTIMESTAMP`, `CURRENT_TIMESTAMP`, and 
`LOCALTIMESTAMP`, but not `CURRENT_DATE`. Source: 
`infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/segment/dml/expression/type/ColumnSegmentBinder.java:61`
   - **OBS-4:** In tag `5.5.3`, `ColumnSegmentBinder` throws 
`ColumnNotFoundException` when no input column is found and binding cannot be 
skipped. Source: 
`infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/segment/dml/expression/type/ColumnSegmentBinder.java:168`
   - **OBS-5:** #38350 was merged with the title `Add DialectFunctionOption to 
handle wrong skip column bind in ColumnSegmentBinder`; its merge commit is 
`840f0de1ac71ec42b1d1575684bea23d794e9543`, and its milestone is `5.5.4`. 
Source: https://github.com/apache/shardingsphere/pull/38350
   - **OBS-6:** Current `dev` checks unparenthesized functions through 
`DatabaseTypeRegistry(...).getDialectDatabaseMetaData().getFunctionOption().getUnparenthesizedFunctionNames()`,
 and `OracleFunctionOption` includes `CURRENT_DATE`. Source: 
`infra/binder/core/src/main/java/org/apache/shardingsphere/infra/binder/engine/segment/dml/expression/type/ColumnSegmentBinder.java:87`,
 
`database/connector/dialect/oracle/src/main/java/org/apache/shardingsphere/database/connector/oracle/metadata/database/option/OracleFunctionOption.java:33`
   
   ### Root Cause
   
   - **Observation:** #38712 fails during SQL bind, not during Oracle database 
execution (`OBS-2`).
   - **Observation:** The 5.5.3 `ColumnSegmentBinder` skip list does not 
include `CURRENT_DATE`, so bare `CURRENT_DATE` continues into the normal 
column-binding path (`OBS-3`, `OBS-4`).
   - **Observation:** #38350 already fixed the same class of 
unparenthesized-function skip-binding problem through dialect-level 
`DialectFunctionOption`, and the Oracle dialect now includes `CURRENT_DATE` 
(`OBS-5`, `OBS-6`).
   - **Inference:** The root cause hit by #38712 is already covered by #38350, 
so this should be handled as a duplicate instead of a new bug (`OBS-2`, 
`OBS-3`, `OBS-5`, `OBS-6`).
   - **Confidence:** High.
   
   ### Problem Analysis
   
   - **Issue Type:** Duplicate
   - **Evidence:** #38712 is an incorrect `ColumnSegmentBinder` column-binding 
failure for Oracle bare `CURRENT_DATE`; #38350 fixed the same 
`ColumnSegmentBinder` unparenthesized-function skip-binding logic and covers 
`CURRENT_DATE` in the Oracle dialect.
   - **Label Recommendation:** `type: duplicate`, `in: SQL bind`, `db: Oracle`
   
   ### Problem Conclusion
   
   - **Evidence Confidence:** High
   - **Impact Scope:** Oracle + ShardingSphere-JDBC 5.5.3 + bare `CURRENT_DATE` 
expressions
   - **Topology:** JDBC + governance mode not provided / not material
   - **Issue Type:** Duplicate
   - **Duplicate Of:** #38350
   - **Fix PR:** #38350
   - **Merged In:** `840f0de1ac71ec42b1d1575684bea23d794e9543`, milestone 
`5.5.4`
   - **Recommended Labels:** `type: duplicate`, `in: SQL bind`, `db: Oracle`
   - **Next Action:** Ask the reporter to verify with a version that includes 
#38350. If it is no longer reproducible, close this as a duplicate covered by 
#38350.


-- 
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]

Reply via email to