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

Inconsistency in the results when using the COALESCE function

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • 10.6.0
    • N/A
    • Data types, Server
    • None

    Description

      There is an inconsistency in the results when using the COALESCE function.

      Set up table t0:

      CREATE TABLE t0 (c0 BIT, c1 BIT);
      INSERT INTO t0 VALUES (0, 1);
      

      Use COALESCE in a SELECT query:

      (SELECT (COALESCE(t0.c0, t0.c1)) AS c0 FROM t0);
      --Result: 48
      

      Store the result of COALESCE in another table t1 and SELECT:

      CREATE TABLE t1 AS (SELECT (COALESCE(t0.c0, t0.c1)) AS c0 FROM t0);
      SELECT * FROM t1;
      --Result: 0
      

      The result should be consistent regardless of whether the result is directly selected or stored in another table.

      Attachments

        Issue Links

          Activity

            Transition Time In Source Status Execution Times
            Sergei Golubchik made transition -
            Open Closed
            127d 5h 57m 1

            People

              Unassigned Unassigned
              dwenking chaos
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.