Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nboyJ-0006k1-O0 for pgsql-committers@arkaria.postgresql.org; Tue, 05 Apr 2022 19:36:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nboyI-0003KC-B2 for pgsql-committers@arkaria.postgresql.org; Tue, 05 Apr 2022 19:36:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nboyI-0003K3-4I for pgsql-committers@lists.postgresql.org; Tue, 05 Apr 2022 19:36:10 +0000 Received: from relay2-d.mail.gandi.net ([2001:4b98:dc4:8::222]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nboyD-0005D7-Ep for pgsql-committers@lists.postgresql.org; Tue, 05 Apr 2022 19:36:09 +0000 Received: (Authenticated sender: adsend@dunslane.net) by mail.gandi.net (Postfix) with ESMTPSA id 9250A40007; Tue, 5 Apr 2022 19:36:00 +0000 (UTC) Message-ID: <29db47b6-1193-c568-245e-511247324d86@dunslane.net> Date: Tue, 5 Apr 2022 15:35:58 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: pgsql: JSON_TABLE Content-Language: en-US To: Oleg Bartunov Cc: Erik Rijkers , pgsql-committers@lists.postgresql.org References: <844dcd0e-3f02-ce5d-a319-7787c028d779@dunslane.net> From: Andrew Dunstan In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 4/5/22 15:05, Oleg Bartunov wrote: > On Tue, Apr 5, 2022 at 1:31 AM Andrew Dunstan wrote: >> >> On 4/4/22 18:16, Erik Rijkers wrote: >>> Op 04-04-2022 om 22:23 schreef Andrew Dunstan: >>>> JSON_TABLE >>> Great that this is now committed! >>> >>> I notice one changed item: the NESTED-PATH-phrase does not accept an >>> alias anymore. The JSON_PATH v59 patches still had: >>> >>> | NESTED PATH json_path_specification [ AS path_name ] >>> COLUMNS ( json_table_column [, ...] ) >>> >>> My complaint is only half-hearted because I don't really understand >>> what the use of such nested-path aliases are. But it's a change from >>> the earlier patch, and the nested-path aliases are used too in the >>> 2017-03 'Technical report ISO/IEC TR 19075-6', which is as near I have >>> to a SQL Standard description. >>> >>> FWIW, I attach example sql+data from that .pdf from ISO (which is not >>> online anymore). >>> >>> >> These commits are being staggered. The last code patches will be >> committed tomorrow. > as for PostgreSQL 15devel-master/fadb48b00e aliases AS works > > SELECT > jt.* > FROM > house, > JSON_TABLE(js, '$.floor[*]' AS lvl COLUMNS ( > level int, > NESTED PATH '$.apt[*] ? (@.area > 1000)' AS big COLUMNS ( > no int > ) > ) PLAN (lvl OUTER big) ) jt; > level | no > -------+-------- > 1 | (null) > 2 | (null) > (2 rows) Yeah, and I think that's the answer to Erik's question about why we need it, it's so you have a name you can refer to in the PLAN clause, as in you example. cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com