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

   ##  Issue Understanding
   
     - In ShardingSphere-Proxy 5.3.2 (PostgreSQL 12.1) with encryption enabled, 
when a subquery assigns an alias to an encrypted column and the outer query 
references that alias, it fails with “no such column/column does not exist”.
   
   ##  Root Cause
   
     - In 5.3.2, the encrypt rewrite loses the column alias when building 
subquery projections: EncryptProjectionTokenGenerator creates ColumnProjection 
instances with the alias set to null, so the rewritten subquery outputs column 
names that don’t match the logical alias
       the outer query expects.
   
   ##  Analysis
   
     - During rewrite, the subquery projection names are replaced by 
cipher/assisted/plain columns without keeping the alias. The outer SELECT/ORDER 
BY/WHERE still binds to the logical alias, but the database returns columns 
under different names, causing “no such column”.
     - This has been fixed in PR #25038: aliases are preserved so rewritten 
column names align with outer bindings. Master and later releases 
(≥5.4.0/5.5.x) include this fix.
   
   ##  Conclusion
   
     - This is a known defect in 5.3.2. Recommendations:
         1. Upgrade to a released version that contains the fix (≥5.4.0; latest 
5.5.x is recommended).
         2. If you cannot upgrade immediately, avoid assigning an alias to an 
encrypted column in a subquery and referencing it in the outer query as a 
temporary workaround.


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