Thread: BUG #14366: jsonb_set() error when modify array element

BUG #14366: jsonb_set() error when modify array element

From
bluevaley@gmail.com
Date:
VGhlIGZvbGxvd2luZyBidWcgaGFzIGJlZW4gbG9nZ2VkIG9uIHRoZSB3ZWJz
aXRlOgoKQnVnIHJlZmVyZW5jZTogICAgICAxNDM2NgpMb2dnZWQgYnk6ICAg
ICAgICAgIHBlbmcgc3VuCkVtYWlsIGFkZHJlc3M6ICAgICAgYmx1ZXZhbGV5
QGdtYWlsLmNvbQpQb3N0Z3JlU1FMIHZlcnNpb246IDkuNi4wCk9wZXJhdGlu
ZyBzeXN0ZW06ICAgd2luOC4xCkRlc2NyaXB0aW9uOiAgICAgICAgCgpzZWxl
Y3QganNvbmJfc2V0KCdbeyJmMSI6MSwiZjIiOm51bGx9LDIsbnVsbCwzXScs
ICd7MH0nLCdbMiwzLDRdJywgZmFsc2UpOw0KaW4gOS42LCBnb3Q6DQpbMiwg
bnVsbCwgM10NCmluIDkuNS40LCBnb3Q6DQpbWzIsIDMsIDRdLCAyLCBudWxs
LCAzXQoK

Re: BUG #14366: jsonb_set() error when modify array element

From
Tom Lane
Date:
bluevaley@gmail.com writes:
> The following bug has been logged on the website:
> Bug reference:      14366
> Logged by:          peng sun
> Email address:      bluevaley@gmail.com
> PostgreSQL version: 9.6.0
> Operating system:   win8.1
> Description:

> select jsonb_set('[{"f1":1,"f2":null},2,null,3]', '{0}','[2,3,4]', false);
> in 9.6, got:
> [2, null, 3]
> in 9.5.4, got:
> [[2, 3, 4], 2, null, 3]

Yeah, this is broken.  Fixed, thanks for the report!

            regards, tom lane

Re: BUG #14366: jsonb_set() error when modify array element

From
Michael Paquier
Date:
On Thu, Oct 13, 2016 at 1:26 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> select jsonb_set('[{"f1":1,"f2":null},2,null,3]', '{0}','[2,3,4]', false);
>> in 9.6, got:
>> [2, null, 3]
>> in 9.5.4, got:
>> [[2, 3, 4], 2, null, 3]
>
> Yeah, this is broken.  Fixed, thanks for the report!

Too late I guess..
--
Michael