pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael@paquier.xyz>
Cc: Merlin Moncure <mmoncure@gmail.com>
Cc: Dmitry Dolgov <9erthalion6@gmail.com>
Cc: yarexeray@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15940: json_populate_recordset fails with ERROR: record type has not been registered
Date: Mon, 19 Aug 2019 18:04:25 -0400
Message-ID: <30049.1566252265@sss.pgh.pa.us> (raw)
In-Reply-To: <20190809023505.GE3194@paquier.xyz>
References: <15940-2ab76dc58ffb85b6@postgresql.org>
	<20190806073209.GI32256@paquier.xyz>
	<CA+q6zcVYyjDEh9hkKi3eG81TBghMRjVySNA4gAsQU0q4gJPbFQ@mail.gmail.com>
	<5154.1565120306@sss.pgh.pa.us>
	<CAHyXU0yu3otAqneN=B+6oRXgDqEAqJt5EtYBn55vGX_PzBpj=w@mail.gmail.com>
	<20190809023505.GE3194@paquier.xyz>

Michael Paquier <michael@paquier.xyz> 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 FROM clause using a column definition list.

			regards, tom lane





view thread (9+ messages)

Message-ID: <30049.1566252265@sss.pgh.pa.us>
Permalink:  ../30049.1566252265@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/30049.1566252265@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, michael@paquier.xyz, mmoncure@gmail.com, 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: <30049.1566252265@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox