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 1ph2Ub-0002Vz-FG for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Mar 2023 06:07:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ph2Ua-0005LD-3T for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Mar 2023 06:07:36 +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 1ph2UZ-0005L3-PR for pgsql-hackers@lists.postgresql.org; Tue, 28 Mar 2023 06:07:35 +0000 Received: from wnew3-smtp.messagingengine.com ([64.147.123.17]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ph2UW-00010p-KN for pgsql-hackers@postgresql.org; Tue, 28 Mar 2023 06:07:35 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.west.internal (Postfix) with ESMTP id 2CA9E2B065EF; Tue, 28 Mar 2023 02:07:28 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Tue, 28 Mar 2023 02:07:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1679983647; x=1679990847; bh=wVRqFG3VGOQob6PWLmpcbwURzDUQhtT0ClE mYqxRdVw=; b=oBlFz8iwqwJleify/z4vyy4Qt92Bxsqq+5Z84nGC5L8/NKT7buS dwL5WIFH/adl5poBAiDk0ok7BEQnxhc/tFfVrtzQChK/bJyQvBuyiNjXvSD331g0 AxkjUSE2nlAvAQyf90cNDF/UgaL4i8vIXB/Vej2GIziYPGMhkfhZiUxfR/EiIBlX 0jvt+j0ry0KmBZCfyCBAhyX4/efdmttK/AGUMoZHqeEC6F4GU4G7l3UJz9qxQ7zA zG6kFz8gDEUha617fVA+lwEwkXUzjIoQZ9zU4rsPq65VWaMaNujNczOgB2MS4J1S imM15qIiVYR2mtvPRTnUiwUO515OwOnX+HA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdehfedguddthecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttdefjeenucfhrhhomheprfgv thgvrhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsegvnh htvghrphhrihhsvggusgdrtghomheqnecuggftrfgrthhtvghrnhepheelffeggedujeet iefhleetuddvieffhfffvdejvdffgeejkeduleduheduieefnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhdrvghishgvnhhtrhgr uhhtsegvnhhtvghrphhrihhsvggusgdrtghomh X-ME-Proxy: Feedback-ID: i131946ab:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Mar 2023 02:07:25 -0400 (EDT) Message-ID: <327817ff-6c71-fd4b-0b10-f98b5c67e9d0@enterprisedb.com> Date: Tue, 28 Mar 2023 08:07:23 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: SQL/JSON revisited Content-Language: en-US To: Alvaro Herrera , Andrew Dunstan Cc: Amit Langote , Andres Freund , vignesh C , PostgreSQL-development , e.indrupskaya@postgrespro.ru References: <20230327185456.wbb5gchworsu3hf7@alvherre.pgsql> From: Peter Eisentraut In-Reply-To: <20230327185456.wbb5gchworsu3hf7@alvherre.pgsql> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 27.03.23 20:54, Alvaro Herrera wrote: > Even so, I was unable to get bison > to accept the 'KEY name VALUES blah' syntax; it might be a > fun/challenging project to change the productions that we use for JSON > names and values: > > +json_name_and_value: > +/* Supporting this syntax seems to require major surgery > + KEY c_expr VALUE_P json_value_expr > + { $$ = makeJsonKeyValue($2, $4); } > + | > +*/ > + c_expr VALUE_P json_value_expr > + { $$ = makeJsonKeyValue($1, $3); } > + | > + a_expr ':' json_value_expr > + { $$ = makeJsonKeyValue($1, $3); } > + ; > > If we uncomment the KEY bit there, a bunch of conflicts emerge. This is a known bug in the SQL standard. Because KEY is a non-reserved keyword, writing KEY (x) VALUE y is ambiguous because KEY could be the keyword for this clause or a function call key(x). It's ok to leave it like this for now.