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

Hybrid functions with JSON arguments do not send format metadata

    XMLWordPrintable

    Details

      Description

      I start mariadb --column-type-info test and run the following script:

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a JSON);
      INSERT INTO t1 VALUES ('{"a":"b"}');
      SELECT a, JSON_COMPACT(a), COALESCE(a) FROM t1;
      

      The output is:

      MariaDB [test]> SELECT a, JSON_COMPACT(a), COALESCE(a) FROM t1;
      Field   1:  `a`
      Org_field:  `a`
      Catalog:    `def`
      Database:   `test`
      Table:      `t1`
      Org_table:  `t1`
      Type:       BLOB (format=json)
      Collation:  utf8_general_ci (33)
      Length:     4294967295
      Max_length: 9
      Decimals:   0
      Flags:      BLOB BINARY 
       
      Field   2:  `JSON_COMPACT(a)`
      Org_field:  ``
      Catalog:    `def`
      Database:   ``
      Table:      ``
      Org_table:  ``
      Type:       LONG_BLOB (format=json)
      Collation:  utf8_general_ci (33)
      Length:     4294967295
      Max_length: 9
      Decimals:   0
      Flags:      BINARY 
       
      Field   3:  `COALESCE(a)`
      Org_field:  ``
      Catalog:    `def`
      Database:   ``
      Table:      ``
      Org_table:  ``
      Type:       LONG_BLOB
      Collation:  utf8_general_ci (33)
      Length:     4294967295
      Max_length: 9
      Decimals:   39
      Flags:      BINARY 
       
      +-----------+-----------------+-------------+
      | a         | JSON_COMPACT(a) | COALESCE(a) |
      +-----------+-----------------+-------------+
      | {"a":"b"} | {"a":"b"}       | {"a":"b"}   |
      +-----------+-----------------+-------------+
      1 row in set (0.000 sec)
      

      Notice, it prints format=json for the first and the second column, but it does not send format for the third column.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bar Alexander Barkov
              Reporter:
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.