Details

      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

        Attachments

          Activity

            People

            • Assignee:
              bertrandop Olivier Bertrand
              Reporter:
              Aurelien_LEQUOY_bis Aurélien LEQUOY
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: