Re: [HACKERS] bug in json_to_record with arrays

2014-12-01 Thread Tom Lane
Merlin Moncure writes: > On Mon, Dec 1, 2014 at 3:01 PM, Tom Lane wrote: >> I'd be good with going to "invalid input syntax" if we also change >> record_in to match. Anyone have a feeling pro or con about that? > I don't know. "malformed array literal" is a mighty big clue that you > have a ba

Re: [HACKERS] bug in json_to_record with arrays

2014-12-01 Thread Merlin Moncure
On Mon, Dec 1, 2014 at 3:01 PM, Tom Lane wrote: > Josh Berkus writes: >> On 12/01/2014 12:30 PM, Tom Lane wrote: >>> Code-wise, yeah, but it would put some pressure on the translators. >>> >>> What did you think of the new error texts in themselves? > >> I would prefer "invalid input syntax" to "

Re: [HACKERS] bug in json_to_record with arrays

2014-12-01 Thread Tom Lane
Josh Berkus writes: > On 12/01/2014 12:30 PM, Tom Lane wrote: >> Code-wise, yeah, but it would put some pressure on the translators. >> >> What did you think of the new error texts in themselves? > I would prefer "invalid input syntax" to "malformed array literal", but > I'll take anything we ca

Re: [HACKERS] bug in json_to_record with arrays

2014-12-01 Thread Josh Berkus
On 12/01/2014 12:30 PM, Tom Lane wrote: > Josh Berkus writes: >> On 11/28/2014 12:55 PM, Tom Lane wrote: >>> * This would only really address Josh's complaint if we were to back-patch >>> it into 9.4, but I'm hesitant to change error texts post-RC1. Thoughts? > >> If we don't fix an error text i

Re: [HACKERS] bug in json_to_record with arrays

2014-12-01 Thread Andres Freund
On 2014-12-01 15:30:06 -0500, Tom Lane wrote: > Josh Berkus writes: > > On 11/28/2014 12:55 PM, Tom Lane wrote: > >> * This would only really address Josh's complaint if we were to back-patch > >> it into 9.4, but I'm hesitant to change error texts post-RC1. Thoughts? > > > If we don't fix an er

Re: [HACKERS] bug in json_to_record with arrays

2014-12-01 Thread Joshua D. Drake
On 12/01/2014 12:28 PM, Josh Berkus wrote: On 11/28/2014 12:55 PM, Tom Lane wrote: * This would only really address Josh's complaint if we were to back-patch it into 9.4, but I'm hesitant to change error texts post-RC1. Thoughts? If we don't fix an error text in an RC, what would we fix in

Re: [HACKERS] bug in json_to_record with arrays

2014-12-01 Thread Tom Lane
Josh Berkus writes: > On 11/28/2014 12:55 PM, Tom Lane wrote: >> * This would only really address Josh's complaint if we were to back-patch >> it into 9.4, but I'm hesitant to change error texts post-RC1. Thoughts? > If we don't fix an error text in an RC, what would we fix in an RC? > That's as

Re: [HACKERS] bug in json_to_record with arrays

2014-12-01 Thread Josh Berkus
On 11/28/2014 12:55 PM, Tom Lane wrote: > * This would only really address Josh's complaint if we were to back-patch > it into 9.4, but I'm hesitant to change error texts post-RC1. Thoughts? If we don't fix an error text in an RC, what would we fix in an RC? That's as minor as things get. -- Jo

Re: [HACKERS] bug in json_to_record with arrays

2014-11-28 Thread Tom Lane
Josh Berkus writes: > On 11/26/2014 12:48 PM, Tom Lane wrote: >> Wouldn't it be better if it said >> >> ERROR: invalid input syntax for array: "["potter","chef","programmer"]" >> DETAIL: Dimension value is missing. >> >> which is comparable to what you'd get out of most other input functions >>

Re: [HACKERS] bug in json_to_record with arrays

2014-11-26 Thread Josh Berkus
On 11/26/2014 12:48 PM, Tom Lane wrote: > Wouldn't it be better if it said > > ERROR: invalid input syntax for array: "["potter","chef","programmer"]" > DETAIL: Dimension value is missing. > > which is comparable to what you'd get out of most other input functions > that were feeling i

Re: [HACKERS] bug in json_to_record with arrays

2014-11-26 Thread Tom Lane
Stephen Frost writes: > * Tom Lane (t...@sss.pgh.pa.us) wrote: >> As far as your request for a better error message is concerned, I'm a >> bit inclined to lay the blame on array_in rather than the JSON code. >> Wouldn't it be better if it said >> >> ERROR: invalid input syntax for array: "["pott

Re: [HACKERS] bug in json_to_record with arrays

2014-11-26 Thread Stephen Frost
* Tom Lane (t...@sss.pgh.pa.us) wrote: > As far as your request for a better error message is concerned, I'm a > bit inclined to lay the blame on array_in rather than the JSON code. > Wouldn't it be better if it said > > ERROR: invalid input syntax for array: "["potter","chef","programmer"]"

Re: [HACKERS] bug in json_to_record with arrays

2014-11-26 Thread Andrew Dunstan
On 11/26/2014 03:48 PM, Tom Lane wrote: Arguably, populate_record_worker should be smart enough to convert somehow, but it isn't today. Looks to me like it wouldn't succeed for the comparable case of converting a sub-object to a Postgres composite type, either. I'm satisfied with regarding tho

Re: [HACKERS] bug in json_to_record with arrays

2014-11-26 Thread Tom Lane
Josh Berkus writes: > On 11/26/2014 11:54 AM, Josh Berkus wrote: >> Tested on 9.4b3, 9.4rc1, 9.5devel >> >> select * from json_to_record(' >> {"id":1,"val":"josh","valry":["potter","chef","programmer"]}') as r(id >> int, val text, valry text[]); >> >> ERROR: missing dimension value >> >> With

Re: [HACKERS] bug in json_to_record with arrays

2014-11-26 Thread Josh Berkus
On 11/26/2014 11:54 AM, Josh Berkus wrote: > Tested on 9.4b3, 9.4rc1, 9.5devel > > select * from json_to_record(' > {"id":1,"val":"josh","valry":["potter","chef","programmer"]}') as r(id > int, val text, valry text[]); > > ERROR: missing dimension value > > With some experimentation, I can't fi

[HACKERS] bug in json_to_record with arrays

2014-11-26 Thread Josh Berkus
Tested on 9.4b3, 9.4rc1, 9.5devel select * from json_to_record(' {"id":1,"val":"josh","valry":["potter","chef","programmer"]}') as r(id int, val text, valry text[]); ERROR: missing dimension value With some experimentation, I can't find any way to convert a JSON array to an array field using js