Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1abSy2-0001JX-Ji for pgsql-committers@arkaria.postgresql.org; Thu, 03 Mar 2016 13:06:58 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1abSy1-0000fg-7X for pgsql-committers@arkaria.postgresql.org; Thu, 03 Mar 2016 13:06:57 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1abSy0-0000fX-OV for pgsql-committers@postgresql.org; Thu, 03 Mar 2016 13:06:56 +0000 Received: from relay5-d.mail.gandi.net ([2001:4b98:c:538::197]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1abSxy-0003dk-6D for pgsql-committers@postgresql.org; Thu, 03 Mar 2016 13:06:55 +0000 Received: from mfilter43-d.gandi.net (mfilter43-d.gandi.net [217.70.178.174]) by relay5-d.mail.gandi.net (Postfix) with ESMTP id CA0D441C0BA; Thu, 3 Mar 2016 14:06:50 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter43-d.gandi.net Received: from relay5-d.mail.gandi.net ([IPv6:::ffff:217.70.183.197]) by mfilter43-d.gandi.net (mfilter43-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id F9Uc2CwDwd2q; Thu, 3 Mar 2016 14:06:49 +0100 (CET) X-Originating-IP: 98.122.164.227 Received: from [192.168.10.146] (unknown [98.122.164.227]) (Authenticated sender: adsend@dunslane.net) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 6FCDE41C084; Thu, 3 Mar 2016 14:06:48 +0100 (CET) Subject: Re: pgsql: Fix json_to_record() bug with nested objects. To: Tom Lane , pgsql-committers@postgresql.org References: From: Andrew Dunstan Message-ID: <56D836E7.4010007@dunslane.net> Date: Thu, 3 Mar 2016 08:06:47 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-committers Precedence: bulk Sender: pgsql-committers-owner@postgresql.org On 03/02/2016 11:31 PM, Tom Lane wrote: > I added a regression test case based on his example, plus parallel tests > for json_to_recordset, jsonb_to_record, jsonb_to_recordset. The latter > three do not exhibit the same bug (which suggests that we may be missing > some opportunities to share code...) Not really. The jsonb variants don't do any re-parsing at all, so lex_level simply doesn't come into play, and for json_to_recordset we want things from lex_level 2, not 1, as the json is supposed to be an array of objects instead of just an object. That's not to say that the code can't be improved - It very probably can. cheers andrew -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers