with recursive t(year, revenue, operating_income, profit)
as (
select f.year, f.revenue, f.operating_income, f.profit
from financials as f
where f.year = 2022
union all
select
t.year + 1,
cast(round(t.revenue * (1 - .2), 0) as int),
t.operating_income,
cast(round(t.revenue * (1 - .2), 0) as int) - t.operating_income
from t
where t.profit >= 0
)
select year, profit from t
limit 10;
-the node-sql-parser version
5.3.3
-the node version
20
Expected behavior
Should process the above query
Screenshots
it works fine with PostgreSQL
Additional context
Add any other context about the problem here.
Describe the bug When we try to have a valid recursive query with PostgreSQL it fails with following error
Database Engine PostgreSQL v16
To Reproduce -the SQL that be parsed
-the node-sql-parser version 5.3.3 -the node version 20
Expected behavior Should process the above query
Screenshots it works fine with PostgreSQL
Additional context Add any other context about the problem here.