Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ftuso-0007JE-S5 for pgsql-docs@arkaria.postgresql.org; Sun, 26 Aug 2018 13:15:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ftusk-00086J-Mq for pgsql-docs@arkaria.postgresql.org; Sun, 26 Aug 2018 13:15:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ftusk-00086C-HE for pgsql-docs@lists.postgresql.org; Sun, 26 Aug 2018 13:15:06 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ftush-0002aO-6N for pgsql-docs@lists.postgresql.org; Sun, 26 Aug 2018 13:15:05 +0000 Received: from bruce by momjian.us with local (Exim 4.84_2) (envelope-from ) id 1ftuse-0006Ln-PC; Sun, 26 Aug 2018 09:15:00 -0400 Date: Sun, 26 Aug 2018 09:15:00 -0400 From: Bruce Momjian To: KES Cc: "pgsql-docs@lists.postgresql.org" Subject: Re: Documentation does not cover multiple WITH in one query Message-ID: <20180826131500.GA26015@momjian.us> References: <153492989238.1378.11935777086367711326@wrigleys.postgresql.org> <20180824202957.GC18798@momjian.us> <9733511535274495@sas2-db6b18f976b3.qloud-c.yandex.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9733511535274495@sas2-db6b18f976b3.qloud-c.yandex.net> User-Agent: Mutt/1.5.23 (2014-03-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sun, Aug 26, 2018 at 12:08:15PM +0300, KES wrote: > > Thank you. That is I am looking for. > Never thought that 'WITH' syntax is described at 'SELECT'. > > Will be very helpful if this will be mentioned on this page: https://www.postgresql.org/docs/10/static/queries-with.html > For an example: > > [ WITH [ RECURSIVE ] with_query [, ...] ] > > and with_query is shown as: > > with_query_name [ ( column_name [, ...] ) ] AS ( select | values | insert | update | delete ) > > For full syntax of `WITH` see https://www.postgresql.org/docs/10/static/sql-select.html There is are no syntax layouts on this page or in similar sections in the docs --- they are reserved for the reference pages. I don't think it makes sense to add it here. One odd thing is that WITH can be used with non-SELECT statements, but we only document it in SELECT, which is odd. I think that is because the SQL standard only uses WITH with SELECT. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + As you are, so once was I. As I am, so you will be. + + Ancient Roman grave inscription +