Thread: documentation for WITH RECURSIVE
Hi, One of our customers had problems with the syntax of WITH RECURSIVE. He suggested that the documentation should be improved, maybe with this sentence: "If any of the CTEs is recursive, the recursive keywork must be present after with", so to make sure that it does not refer to just one of the named subqueries. Regards, Andreas -- 2ndQuadrant - The PostgreSQL Support Company. www.2ndQuadrant.com
Andreas Kretschmer <andreas@a-kretschmer.de> writes: > One of our customers had problems with the syntax of WITH RECURSIVE. He > suggested that the documentation should be improved, maybe with this > sentence: > "If any of the CTEs is recursive, the recursive keywork must be present > after with", so to make sure that it does not refer to just one of the > named subqueries. Hm, was this intended for the SELECT man page (presumably in the "WITH Clause" section), or for section 7.8? In the SELECT page, I'd be inclined to put it after the para about "queries need not be ordered" and phrase it more like If there are multiple queries in the WITH clause, RECURSIVE can be written only once, immediately after WITH. It applies to all queries in the WITH clause (but has no effect on queries that do not use either of these features). regards, tom lane
Am 18.11.19 um 18:32 schrieb Tom Lane: > Andreas Kretschmer <andreas@a-kretschmer.de> writes: >> One of our customers had problems with the syntax of WITH RECURSIVE. He >> suggested that the documentation should be improved, maybe with this >> sentence: >> "If any of the CTEs is recursive, the recursive keywork must be present >> after with", so to make sure that it does not refer to just one of the >> named subqueries. > Hm, was this intended for the SELECT man page (presumably in the > "WITH Clause" section), or for section 7.8? > > In the SELECT page, I'd be inclined to put it after the para about > "queries need not be ordered" and phrase it more like > > If there are multiple queries in the WITH clause, RECURSIVE can > be written only once, immediately after WITH. It applies to all > queries in the WITH clause (but has no effect on queries that do > not use either of these features). > > regards, tom lane yeah, sounds good to me, thx Tom. Regards, Andreas -- 2ndQuadrant - The PostgreSQL Support Company. www.2ndQuadrant.com
Am 18.11.19 um 20:12 schrieb Andreas Kretschmer: > > > Am 18.11.19 um 18:32 schrieb Tom Lane: >> Andreas Kretschmer <andreas@a-kretschmer.de> writes: >>> One of our customers had problems with the syntax of WITH RECURSIVE. He >>> suggested that the documentation should be improved, maybe with this >>> sentence: >>> "If any of the CTEs is recursive, the recursive keywork must be present >>> after with", so to make sure that it does not refer to just one of the >>> named subqueries. >> Hm, was this intended for the SELECT man page (presumably in the >> "WITH Clause" section), or for section 7.8? >> > Hi Tom, it would be good if we can also add this to chapter 7.8, wouldn't it? Regards, Andreas -- 2ndQuadrant - The PostgreSQL Support Company. www.2ndQuadrant.com
Andreas Kretschmer <andreas@a-kretschmer.de> writes: > it would be good if we can also add this to chapter 7.8, wouldn't it? I don't feel a need to. 7.8 isn't attempting to define the syntax precisely. Moreover, we've had this feature since 8.4, and this is the first I've heard of somebody misinterpreting the syntax; so it doesn't seem like it's a huge problem that requires multiple explanations. I've pushed a patch for the SELECT reference page. regards, tom lane