Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hzplT-0002mz-7K for pgsql-bugs@arkaria.postgresql.org; Mon, 19 Aug 2019 22:04:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hzplS-0007LQ-2d for pgsql-bugs@arkaria.postgresql.org; Mon, 19 Aug 2019 22:04:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hzplR-0007LJ-RN for pgsql-bugs@lists.postgresql.org; Mon, 19 Aug 2019 22:04:33 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hzplO-0003s3-AT for pgsql-bugs@lists.postgresql.org; Mon, 19 Aug 2019 22:04:33 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x7JM4P4G030050; Mon, 19 Aug 2019 18:04:26 -0400 From: Tom Lane To: Michael Paquier cc: Merlin Moncure , Dmitry Dolgov <9erthalion6@gmail.com>, yarexeray@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15940: json_populate_recordset fails with ERROR: record type has not been registered In-reply-to: <20190809023505.GE3194@paquier.xyz> References: <15940-2ab76dc58ffb85b6@postgresql.org> <20190806073209.GI32256@paquier.xyz> <5154.1565120306@sss.pgh.pa.us> <20190809023505.GE3194@paquier.xyz> Comments: In-reply-to Michael Paquier message dated "Fri, 09 Aug 2019 11:35:05 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <30048.1566252265.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 19 Aug 2019 18:04:25 -0400 Message-ID: <30049.1566252265@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Michael Paquier writes: > On Tue, Aug 06, 2019 at 02:53:45PM -0500, Merlin Moncure wrote: >> For posterity I agree that OP was essentially exploiting undefined, or >> at least poorly defined, behavior. For my money, I'd advise using >> this function for cases where you don't want to use an in place type, >> just a column list: > If I were to change something here, that would be this error string > exposed to the user. With the current error, there is no real way > that the user knows what is wrong and why he/she should not do that. > Could it be possible to add some recommendation for example on top of > an error "cannot do that because blah"? I concluded that we'd better restore the former behavior, or people will complain that this is a regression. We can however do better than the "record type has not been registered" error, at least for the case where the error is being thrown at runtime. I went with ERROR: could not determine row type for result of json_populate_record HINT: Provide a non-null record argument, or call the function in the FRO= M clause using a column definition list. regards, tom lane