Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XKGaw-0006Oe-Hz for pgsql-bugs@arkaria.postgresql.org; Thu, 21 Aug 2014 00:51:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XKGau-0002EG-Qp for pgsql-bugs@arkaria.postgresql.org; Thu, 21 Aug 2014 00:51:12 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XKGat-0002Dv-Nq for pgsql-bugs@postgresql.org; Thu, 21 Aug 2014 00:51:11 +0000 Received: from relay5-d.mail.gandi.net ([2001:4b98:c:538::197]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1XKGal-0003PL-G8 for pgsql-bugs@postgresql.org; Thu, 21 Aug 2014 00:51:09 +0000 Received: from mfilter18-d.gandi.net (mfilter18-d.gandi.net [217.70.178.146]) by relay5-d.mail.gandi.net (Postfix) with ESMTP id 0D05841C056; Thu, 21 Aug 2014 02:51:00 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter18-d.gandi.net Received: from relay5-d.mail.gandi.net ([217.70.183.197]) by mfilter18-d.gandi.net (mfilter18-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id Vxw2LSrZ9NfM; Thu, 21 Aug 2014 02:50:58 +0200 (CEST) X-Originating-IP: 98.27.58.255 Received: from [192.168.10.146] (cpe-098-027-058-255.nc.res.rr.com [98.27.58.255]) (Authenticated sender: adsend@dunslane.net) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 4006E41C060; Thu, 21 Aug 2014 02:50:56 +0200 (CEST) Message-ID: <53F5426F.1040300@dunslane.net> Date: Wed, 20 Aug 2014 20:50:55 -0400 From: Andrew Dunstan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Tom Lane CC: Peter Geoghegan , justin.vanwinkle@gmail.com, pgsql-bugs Subject: Re: BUG #11207: empty path will segfault jsonb #> References: <20140818195634.2543.56277@wrigleys.postgresql.org> <22294.1408487132@sss.pgh.pa.us> <26461.1408497576@sss.pgh.pa.us> <27009.1408558097@sss.pgh.pa.us> <28104.1408561567@sss.pgh.pa.us> <53F4FD94.4070201@dunslane.net> <5738.1408568221@sss.pgh.pa.us> <25391.1408577416@sss.pgh.pa.us> In-Reply-To: <25391.1408577416@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 08/20/2014 07:30 PM, Tom Lane wrote: > I wrote: >> I think returning NULL is the right thing here, really. Aside from being >> arguably more convenient for indexing, we will get less push-back if we >> make some operators go from throwing errors to returning null than if >> we make some other operators go the other way. > Attached is a proposed patch (against HEAD and 9.4 git tip) that has > these effects: > > 1. #> now returns the input object if the RHS array is empty; So will val #>> '{}' now return a dequoted bare scalar string? I think that's where the OP actually came into this. > > 2. Error cases in -> and #> are all removed in favor of returning NULL. > > The regression test changes show that we were really pretty inconsistent > about whether to throw error or return NULL for cases where the JSON > tree structure didn't match the extraction request. I think having a > uniform rule is a definite improvement. > > Works for me. Thans for cleaning this up. cheers andrew -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs