[MDEV-13922] Connect + json Created: 2017-09-27  Updated: 2020-12-01

Status: Confirmed
Project: MariaDB Server
Component/s: Storage Engine - Connect
Affects Version/s: 10.0, 10.1, 10.2
Fix Version/s: 10.2

Type: Bug Priority: Major
Reporter: Aurélien LEQUOY Assignee: Olivier Bertrand
Resolution: Unresolved Votes: 0
Labels: connect-engine


 Description   

use test
create table gg(gg text);
 
insert into gg values('[{"key":"universe","value":"8574450","additionalData":{"name":"Accessoires et consommables","code":"MC-16058","valueCode":"universe-hccid-32"}},{"key":"area","value":"8574702","additionalData":{"name":"Accessoire pour Ordinateur Portable et PDA","code":"MC-3794","valueCode":"area-hccid-32-331"}},{"key":"category","value":"43132065","additionalData":{"name":"Sacoche, Housse et Sac \u00e0 dos pour ordinateur portable","code":"MC-11547","valueCode":"category-hccid-32-3250"}}]');
 
 
select jsonget_string(gg,replace(jsonlocate(gg,"category"),"key","value") , "value") as gg from gg;
 
+------+
| gg   |
+------+
| NULL |
+------+
1 row in set, 1 warning (0.01 sec)

if we make in 2 step works perfectly :

select jsonlocate(gg,"category") as gg from gg;
+----------+
| gg       |
+----------+
| $[2].key |
+----------+
1 row in set (0.01 sec)
 
select jsonget_string(gg,replace("$[2].key","key","value") , "value") as gg  from gg;
+----------+
| gg       |
+----------+
| 43132065 |
+----------+
1 row in set (0.00 sec)

work around :

select jsonget_string(jsonget_string(gg,replace(jsonlocate(gg,"category"),"key","*") ), "value") as gg from gg;
+----------+
| gg       |
+----------+
| 43132065 |
+----------+
1 row in set (0.00 sec)

It seem the buffer is not reinitialized when we looking by the path, if we apply jsonget_string it probably make a new init and work fine.

PS : i don't receive mail anymore from jira, and impossible to login with my previous account if you can help me with this.

Aurélien



 Comments   
Comment by Aurélien LEQUOY [ 2017-09-27 ]

same behavior on 10.0 / 10.1 and 10.2

Comment by Elena Stepanova [ 2017-09-28 ]

MariaDB [test]> select jsonget_string(gg,replace(jsonlocate(gg,"category"),"key","value") , "value") as gg from gg;
+------+
| gg   |
+------+
| NULL |
+------+
1 row in set, 1 warning (0.00 sec)
 
MariaDB [test]> show warnings;
+---------+------+--------------------------------------------------------------------------------+
| Level   | Code | Message                                                                        |
+---------+------+--------------------------------------------------------------------------------+
| Warning | 1105 | Not enough memory in Work area for request of 568072 (used=572304 free=482526) |
+---------+------+--------------------------------------------------------------------------------+
1 row in set (0.00 sec)

Comment by Aurélien LEQUOY [ 2018-03-09 ]

any news ?

Generated at Thu Feb 08 08:09:27 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.