|From:||Vik Fearing <vik(at)postgresfriends(dot)org>|
|To:||Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>|
|Subject:||Re: SEARCH and CYCLE clauses|
|Views:||Raw Message | Whole Thread | Download mbox | Resend email|
On 5/22/20 12:40 PM, Vik Fearing wrote:
>>> 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.
|Next Message||Vik Fearing||2020-12-08 16:33:55||Re: SEARCH and CYCLE clauses|
|Previous Message||Gilles Darold||2020-12-08 16:05:34||Re: MultiXact\SLRU buffers configuration|