Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-17578

JSON_ARRAY returns list of String when given a list of integer by passing in variables in stored procedure

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 10.3.8, 10.2, 10.3
    • 10.4
    • JSON
    • None
    • MacBook Pro (13-inch, 2017, Two Thunderbolt 3 ports)
      OS High Sierra V10.13.6

    Description

      When I try to use JSON_ARRAY in a stored procedure, it outputs an array of String even though a list of Integer was given.

      DELIMITER //
       
      DROP PROCEDURE IF EXISTS test;
       
      CREATE PROCEDURE test(OUT testOutput TEXT)
      BEGIN
        DECLARE C1 INT;
        DECLARE C2 INT;
       
        select count(*) from `tb1` into C1;
        select count(*) from `tb2` into C2;
       
        select JSON_ARRAY(C1
                 , C2) INTO testOutput;
       
      END;
      //
       
      DELIMITER ;
       
      CALL test(@testOutput);
       
      SELECT @testOutput;
      

      output is : ["1", "2"]

      If I change the last line into:

      select JSON_ARRAY((select count(*) from `tb1`)
                 , C2) INTO testOutput;
      

      output is correct as : [ 1, 2 ]

      Attachments

        Activity

          People

            rucha174 Rucha Deodhar
            Stevan0102 Stevan0102
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.