I'm trying to define a recursion on a view that I created with "with". However, there is a syntax error. Is is not possible to define a temp. view with "with" and then also define a recrusion with "with"?
Thanks in advance for your help!
select version();
Does return: PostgreSQL 14.1, compiled by Visual C++ build 1914, 64-bit
with symmMergesWith as (
select *
from (
select m1.sea1, m1.sea2
from mergeswith m1
union
select m2.sea2, m2.sea1
from mergeswith m2
) as mws
),
recursive reachable(city, sea) as (
select l.city, l.sea
from located l
where l.city = 'Athenes'
union
select located.city, symmMergesWith.sea2
from located, symmMergesWith
where sea = symmMergesWith.sea1
)
select * from reachable;
[42601] ERROR: Syntaxerror et "reachable"