Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-1098

JSON类型字段在select union中返回列类型错误

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Duplicate
    • 3.0.5
    • N/A
    • Other
    • 操作系统:Windows10专业版;
      MariaDB Connector/J版本:3.1.4
      MySQL Server版本:5.7.24
      IntelliJ IDEA: 2019.2

    Description

      操作系统:Windows10专业版;
      MariaDB Connector/J版本:3.1.4
      MySQL Server版本:5.7.24
      IntelliJ IDEA: 2019.2
      客户端代码:
      private static String url = "jdbc:mariadb://127.0.0.1:3306/world?useUnicode=true&characterEncoding=utf-8";

      public static void main(String args[]) {
      try (Connection conn = DriverManager.getConnection(url, "root", "xxxxxx")) {
      String sql = "(select json_col from json1) union all (select json_col from json2) order by 1 asc;";
      try (Statement statement = conn.createStatement();
      ResultSet resultSet = statement.executeQuery(sql)) {
      ResultSetMetaData rsmd = resultSet.getMetaData();
      while (resultSet.next()) {

      }
      }
      } catch (Throwable e)

      { e.printStackTrace(); }

      }

      问题现象:
      1、当使用select UNION时(select json_col from json1) union all (select json_col from json2) order by 1 asc;,查询结果集返回列类型为BLOB,是错误的。
      无法上传附件截图,可在IDEA中断点查看rsmd的fieldPackets,第一项为BlobColumn(其dataType为BLOB)

      2、当未使用select UNION时select json_col from json1 order by 1 asc,查询结果集返回列类型为JSON,是正确的。
      无法上传附件截图,可在IDEA中断点查看rsmd的fieldPackets,第一项为JsonColumn(其dataType为JSON);

      Attachments

        Issue Links

          Activity

            People

              diego dupin Diego Dupin
              wangxinyu wangxinyu
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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