Re: [PATCH] Allow multiple recursive self-references
От | Peter Eisentraut |
---|---|
Тема | Re: [PATCH] Allow multiple recursive self-references |
Дата | |
Msg-id | 98d7bb5a-0f01-5b3f-3e06-923492d9a15f@enterprisedb.com обсуждение исходный текст |
Ответ на | Re: [PATCH] Allow multiple recursive self-references (Denis Hirn <denis.hirn@uni-tuebingen.de>) |
Ответы |
Re: [PATCH] Allow multiple recursive self-references
|
Список | pgsql-hackers |
On 11.01.22 12:33, Denis Hirn wrote: >> I have been studying this a bit more. I don't understand your argument here. >> Why would this query have different semantics than, say >> >> WITH RECURSIVE t(n) AS ( >> VALUES (1) >> UNION ALL >> VALUES (2) >> UNION ALL >> SELECT n+1 FROM t WHERE n < 100 >> ) SELECT * FROM t LIMIT 100; >> >> The order of UNION branches shouldn't be semantically relevant. > > WITH RECURSIVE (ab)uses the (typically associative and commutative) UNION [ALL] clause, > and fundamentally changes the semantics – associativity and commutativity no longer apply. > I think your confusion stems from this ambiguity. The language in the SQL standard does not support this statement. There is nothing in there that says that certain branches of the UNION in a recursive query mean certain things. In fact, it doesn't even require the query to contain a UNION at all. It just says to iterate on evaluating the query until a fixed point is reached. I think this supports my claim that the associativity and commutativity of a UNION in a recursive query still apply. This is all very complicated, so I don't claim this to be authoritative, but I just don't see anything in the spec that supports what you are saying.
В списке pgsql-hackers по дате отправления: