Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iWkuW-0005jc-Bp for pgsql-docs@arkaria.postgresql.org; Mon, 18 Nov 2019 17:34:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iWkuT-0005uI-HS for pgsql-docs@arkaria.postgresql.org; Mon, 18 Nov 2019 17:33:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iWksp-0001SX-5e for pgsql-docs@lists.postgresql.org; Mon, 18 Nov 2019 17:32:15 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iWksm-0003bF-F8 for pgsql-docs@lists.postgresql.org; Mon, 18 Nov 2019 17:32:13 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id xAIHW8m2020713; Mon, 18 Nov 2019 12:32:08 -0500 From: Tom Lane To: Andreas Kretschmer cc: pgsql-docs@lists.postgresql.org Subject: Re: documentation for WITH RECURSIVE In-reply-to: References: Comments: In-reply-to Andreas Kretschmer message dated "Mon, 18 Nov 2019 15:36:24 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <20711.1574098328.1@sss.pgh.pa.us> Date: Mon, 18 Nov 2019 12:32:08 -0500 Message-ID: <20712.1574098328@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andreas Kretschmer 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