) Invalid operation: plan should not reference subplan's variable

Hi! does anybody know what happen to my code? I was using sql in quicksight to prepare data, then happened this:

Error details

region: eu-west-1
timestamp: 1673292426845
requestId: 971acbe3-c266-4bae-8c09-ec54258c99ca
sourceErrorCode: 500310
sourceErrorMessage: Amazon Invalid operation: plan should not reference subplan’s variable;
sourceErrorState: XX000
sourceException: java.sql.SQLException
sourceType: REDSHIFT

Hi @ztao39

The issue appears to be with the custom SQL query being used. Can you run the query against your Redshift cluster using any IDE or Redshift query editor and check if the error persists? If so, the query has to be modified.

Please let us know if the query works without any issues in your IDE/query editor.

Best,
Raj

it worked in redshift but not in quicksight