terrymanu commented on issue #38305:
URL:
https://github.com/apache/shardingsphere/issues/38305#issuecomment-3988621875
Problem Understanding
Issue #38305 (https://github.com/apache/shardingsphere/issues/38305)
reports that MySQL protocol SQL (LIMIT 0, 200) was not translated when routed
to PostgreSQL 16 via ShardingSphere-Proxy 5.5.2, resulting in PostgreSQL syntax
error.
- Topology:
- Access mode: Proxy
- Governance mode: Standalone
- Registry/config center: N/A (Standalone)
- Fast triage gate:
1. Repro evidence provided (version/config/SQL/log): Yes
2. Expected behavior boundary in official docs: Yes
3. Repo code/tests confirm actual behavior: Yes
Provisional type: Misunderstanding / Invalid Usage
———
Root Cause
sqlTranslator.type: NATIVE in 5.5.2 does not implement real dialect
conversion; it effectively passes SQL through. So MySQL-style LIMIT
offset,count reaches PostgreSQL unchanged and fails.
———
Problem Analysis
Observations:
- OBS-1: The issue body shows actual SQL remains ... LIMIT 0, 200, then
PostgreSQL throws LIMIT #,# syntax is not supported.
Source: https://github.com/apache/shardingsphere/issues/38305
- OBS-2: Official 5.5.2 docs state for NATIVE: “Default SQL translator,
does not implement yet.”
Source:
https://github.com/apache/shardingsphere/blob/5.5.2/docs/document/content/user-manual/common-config/builtin-algorithm/sql-translator.en.md
- OBS-3: NativeSQLTranslator#translate returns the original SQL/parameters
(// TODO present).
Source: NativeSQLTranslator.java:35
- OBS-4: Unit test confirms NATIVE returns unchanged SQL.
Source: NativeSQLTranslatorTest.java:39
- OBS-5: SQLTranslatorRule invokes translator only when parser DB type
differs from storage DB type.
Source: SQLTranslatorRule.java:65
- OBS-6: Rewrite engine uses translator output as final SQL; if unchanged,
original SQL is sent downstream.
Source: RouteSQLRewriteEngine.java:208
Inferences:
- INF-1 (from OBS-1/2/3/4/5/6): Current behavior matches documented and
implemented behavior.
- INF-2 (from OBS-2/3/4): This is expectation mismatch, not a code
regression bug.
- INF-3 (from OBS-5/6): useOriginalSQLWhenTranslatingFailed=true applies
to translation exceptions, not to “translator returns unchanged SQL”.
———
Problem Conclusion
Classification should be Misunderstanding / Invalid Usage, not Bug.
The observed failure is expected under current NATIVE translator
capability in 5.5.2.
--
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]