On 5/22/20 12:40 PM, Vik Fearing wrote: >>> 2) >>> This query is an infinite loop, as expected: >>> >>> with recursive a as (select 1 as b union all select b from a) >>> table a; >>> >>> But it becomes an error when you add a cycle clause to it: >>> >>> with recursive a as (select 1 as b union all table a) >>> cycle b set c to true default false using p >>> table a; >>> >>> ERROR: each UNION query must have the same number of columns >> table a expands to select * from a, and if you have a cycle clause, then >> a has three columns, but the other branch of the union only has one, so >> that won't work anymore, will it? > It seems there was a copy/paste error here. The first query should have > been the same as the second but without the cycle clause. > > It seems strange to me that adding a <search or cycle clause> would > break a previously working query. I would rather see the * expanded > before adding the new columns. This is a user's opinion, I don't know > how hard that would be to implement.
After thinking about it quite a bit more, I have changed my mind on this. The transformation does add columns to the <with list element> and so TABLE or SELECT * should see them. Especially since they see them from outside of the wle. -- Vik Fearing