Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rAtnI-008dqb-SL for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Dec 2023 15:26:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rAtnH-00AUkt-4s for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Dec 2023 15:26:35 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rAtnF-00AUkk-Ti for pgsql-hackers@lists.postgresql.org; Wed, 06 Dec 2023 15:26:34 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rAtn8-0096Fc-NP for pgsql-hackers@postgresql.org; Wed, 06 Dec 2023 15:26:32 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailout.nyi.internal (Postfix) with ESMTP id A59AF5C0262; Wed, 6 Dec 2023 10:26:25 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Wed, 06 Dec 2023 10:26:25 -0500 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 :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1701876385; x= 1701962785; bh=M+2aUPRtzfOgAsJ2R0uIMl8siiaL1FnyezIV5DKSBgk=; b=E 1ZDOad02COrM0b2fQ9ahoObA8f0m+qyTJ3Ud4A0bwYDgvOSjPrGCOIdjzIwJ4kw7 NSRD2lOzdWo5yG5879wrL2a8VZiRo3rJk4oInMx2+7dPOg6h6EmmOI3Emjbfn/bd JRoGOoiLhJdeaJYSTeHC7JnRmPFej5m5VZ5w1cZR31ysVEWaaxIsKmpfSBhXFgnf y6gouVfiPXU2/p62j96BOP1O7jjUBebr3fphTnkiWryx0IPsLu/QrypEvSJ87iy4 YtgJ4Qe7LE9YIcxK7Xm3i6r+Yqg+sjS20dPGhTzFKAWK5InODXS9ebe+dg5Xhioz mu46GmpCyj4iQOxcmQqUg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudektddgjeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffhjeejhffgieeuueekjeek fffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhv hhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 6 Dec 2023 10:26:24 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1701876381; bh=dLM2aw7NeTgauXlktf4yud9cpRvKUS/WO8Y5HhF7xlQ=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=gQ+H8O0LYsEhOEWSnCkkfuf/0PHVzpYgL/u6qkyZ6G5OGXOSJcOgreAF7Zeu23ODy 5g+XL5jdnx4/HRvsqDF1Azr8Mii4xHBlgoKUp2P3xxrKHSYo6K7tmxs693B3c79u9v nXyJjVVX5qtE0l/KPEYPHJxWJbMFUqcZrieDyuF8jCPPDjZwj/mmY0u3/67ezZ5MmJ Ha/sWrCgph/6jm1g2P5Cnza03fjNLRymUrOXfFxA85Kuvqwh0SiaTH68ko8jMQfLy2 M0vBZBwkFRlAsrhiODjRWX6zJwcklSeEf/4ISXphEzbjVNGjM/m9g8qslFfflss9Ds O/SYfPuvuUVwQ== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id 2EC41BF; Wed, 6 Dec 2023 16:26:21 +0100 (CET) Date: Wed, 6 Dec 2023 16:26:21 +0100 From: Alvaro Herrera To: Amit Langote Cc: jian he , Andres Freund , Andrew Dunstan , Erik Rijkers , PostgreSQL-development Subject: Re: remaining sql/json patches Message-ID: <202312061526.g53ppimnvxxd@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-Dec-06, Amit Langote wrote: > I think I'm inclined toward adapting the LA-token fix (attached 0005), > because we've done that before with SQL/JSON constructors patch. > Also, if I understand the concerns that Tom mentioned at [1] > correctly, maybe we'd be better off not assigning precedence to > symbols as much as possible, so there's that too against the approach > #1. Sounds ok to me, but I'm happy for this decision to be overridden by others with more experience in parser code. > Also I've attached 0006 to add news tests under ECPG for the SQL/JSON > query functions, which I haven't done so far but realized after you > mentioned ECPG. It also includes the ECPG variant of the LA-token > fix. I'll eventually merge it into 0003 and 0004 after expanding the > test cases some more. I do wonder what kinds of tests we normally add > to ECPG suite but not others? Well, I only added tests to the ecpg suite in the previous round of SQL/JSON deeds because its grammar was being modified, so it seemed possible that it'd break. Because you're also going to modify its parser.c, it seems reasonable to expect tests to be added. I wouldn't expect to have to do this for other patches, because it should behave like straight SQL usage. Looking at 0002 I noticed that populate_array_assign_ndims() is called in some places and its return value is not checked, so we'd ultimately return JSON_SUCCESS even though there's actually a soft error stored somewhere. I don't know if it's possible to hit this in practice, but it seems odd. Looking at get_json_object_as_hash(), I think its comment is not explicit enough about its behavior when an error is stored in escontext, so its hard to judge whether its caller is doing the right thing (I think it is). OTOH, populate_record seems to have the same issue, but callers of that definitely seem to be doing the wrong thing -- namely, not checking whether an error was saved; particularly populate_composite seems to rely on the returned tuple, even though an error might have been reported. (I didn't look at the subsequent patches in the series to see if these things were fixed later.) -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/