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

unexpected type changing after changing AVG to MAX

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 12.0.2
    • None
    • Data types
    • None
    • mysql> select version();
      +------------------------+
      | version() |
      +------------------------+
      | 12.0.2-MariaDB-ubu2404 |
      +------------------------+
      1 row in set (0.00 sec)

    Description

      the AVG function returns decimal type,when union between the decimal type and the date type ,the decimal type and the date type become the blob type.But the decimal type should perfome like the int type becoming string type,and the date type shouldn't change

      mysql> (SELECT MAX(1) as col FROM t1) UNION ALL (SELECT CURDATE() as col);
      +------------+
      | col        |
      +------------+
      | 1          |
      | 2025-10-17 |
      +------------+
      2 rows in set (0.00 sec)
       
      mysql> (SELECT AVG(1) as col FROM t1) UNION ALL (SELECT CURDATE() as col);
      +------------------------+
      | col                    |
      +------------------------+
      | 0x312E3030303030303030 |
      | 0x323032352D31302D3137 |
      +------------------------+
      2 rows in set (0.00 sec)
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            chen7897 cl hl
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.