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

Unexpected ROW_NUMBER upon SELECT from JSON_TABLE with erroneous JSON doc

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.7
    • 10.11
    • JSON, Server
    • None

    Description

      MariaDB [test]> SELECT * FROM JSON_TABLE('11x1', '$' COLUMNS(o FOR ORDINALITY)) AS jt;
      ERROR 4038 (HY000): Syntax error in JSON text in argument 1 to function 'JSON_TABLE' at position 3
       
      Query OK, 0 rows affected (0.000 sec)
       
      Query OK, 0 rows affected (0.000 sec)
       
      +------+
      | @n   |
      +------+
      |    2 |
      +------+
      1 row in set (0.000 sec)
      

      I don't know what to make out of it, clearly there is no 2nd row, but maybe it can be rationalized in some way based on internal JSON_TABLE implementation.
      Also oddly, it doesn't apply to JSON docs which start erroneously, i.e.

      MariaDB [test]> SELECT * FROM JSON_TABLE('x11', '$' COLUMNS(o FOR ORDINALITY)) AS jt;
      ERROR 4038 (HY000): Syntax error in JSON text in argument 1 to function 'JSON_TABLE' at position 1
       
      MariaDB [test]> set @n= null; get diagnostics condition 1 @n = error_index; select @n;
      Query OK, 0 rows affected (0.000 sec)
       
      Query OK, 0 rows affected (0.000 sec)
       
      +------+
      | @n   |
      +------+
      |    1 |
      +------+
      1 row in set (0.000 sec)
      

      So, it looks like the counter is increased if the first symbol in the doc leaves hope that it is a valid document.

      Maybe it's not ERROR_INDEX issue but the general counter's, but I haven't yet invented an example to verify it, so I'm keeping it a 10.7 / ERROR_INDEX issue for now.

      Attachments

        Issue Links

          Activity

            People

              rucha174 Rucha Deodhar
              elenst Elena Stepanova
              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.