WITH RECURSIVE 作为查询中的第二部分 CTE。 Postgres

WITH RECURSIVE as second part CTE in query. Postgres

如何编写这样的查询:

with t1 as 
(
select id 
from table1
),
RECURSIVE t2(
select * from t2
union
...
)

目前不允许吗?

无论您将递归 CTE 放在哪里,recursive 都需要紧跟在 WITH 之后:

with recursive t1 as 
(
  select id 
  from table1
), t2 (
  select *  
  from t2
  union
  ...
)
...