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

   ##  Issue Understanding
   
     - Direct PostgreSQL connections in JDBC Simple Query mode parse boolean 
columns from t/f correctly; through ShardingSphere Proxy 5.5.2 the same query 
returns true/false strings, leading to mis-parsed booleans.
     - Extended Query/PreparedStatement path does not show the issue.
   
   ##  Root Cause
   
     - Proxy’s Simple Query path (PostgreSQLComQueryExecutor#getQueryRowPacket 
-> PostgreSQLDataRowPacket#writeTextValue) outputs non-binary columns via 
toString(), so booleans become true/false.
     - The Extended Query path already normalizes booleans using 
PostgreSQLTextBoolUtils to t/f, so behaviors diverge and violate the PostgreSQL 
text protocol boolean format.
   
   ##  Analysis
   
     - PostgreSQL text protocol requires t/f for boolean values (official docs: 
https://www.postgresql.org/docs/current/datatype-boolean.html).
     - When JDBC uses Simple Query (e.g., Statement or preferQueryMode=simple), 
Proxy’s Simple Query implementation emits true/false; PG JDBC expects t/f in 
Simple mode and mis-parses otherwise.
     - PreparedStatement/Extended Query uses the correct t/f format, so it’s 
unaffected. This is a Proxy PostgreSQL text-protocol compatibility bug.
   
   ##  Conclusion
   
     - Confirmed ShardingSphere Proxy PostgreSQL Simple Query boolean output 
format bug.
     - Temporary workaround: use PreparedStatement or avoid 
preferQueryMode=simple so JDBC uses Extended Query.
     - Fix suggestion: in the Simple Query path, emit booleans as t/f per 
PostgreSQL text protocol (reuse PostgreSQLTextBoolUtils and branch on column 
type, aligning with the Extended path). 
   
   We warmly invite community contributors to submit a PR with the fix and 
accompanying tests!


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