Query execution issue with CTE in xata.sql
I am trying to exceute a query in xata.sql but it thorws an error where I try to use a CTE.
CTE as a general works but whe, for example if I try to use select * for ProductMaxDiscount ; it is working. But if I use an alias for the cte and refer them in select or try to join with other, I get table not found error.
I tried the query in other postgres env, it is working fine. Below is the query I want to execute. And below that I'll attach the ddl for quick start for testing.
```
3 Replies
thank you so much for detailed steps to reproduce. We'll have a look and report back!
hi, i am looking into the problem you reported. unfortunately, i cannot reproduce the issue you see. could you please tell me more details about your issue? when did you create the database? is this a postgresql-enabled database? are you using the REST API endpoint to execute the query?
ha, i can reproduce it now
i submitted the fix, i will ping you when the fix is deployed to production. thank you for your patience!
@Raveen the fix is deployed to prod. let me know if the issue still persist
Thanks, will have a look at it