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

Wrong translation and warning from BIT in virtual column

    XMLWordPrintable

Details

    Description

      I'm not sure if this is expected, but it seems at least counterintuitive to me:

      Reproduce

      create table t (c1 bit, c2 long as (c1) virtual);
      insert into t values (1, default);
      select cast(c1 as unsigned) c1, c2 from t;
      select cast(c1 as unsigned) c1, 0 + c2 from t;
      drop table t;
      

      Result

      create table t (c1 bit, c2 long as (c1) virtual);
      insert into t values (1, default);
      select cast(c1 as unsigned) c1, c2 from t;
      c1      c2
      1
      select cast(c1 as unsigned) c1, 0 + c2 from t;
      c1      0 + c2
      1       0
      Warnings:
      Warning 1292    Truncated incorrect DOUBLE value: '\0001'
      drop table t;
      

      Expected

      select cast(c1 as unsigned) c1, c2 from t;
      c1      c2
      1       1
      select cast(c1 as unsigned) c1, 0 + c2 from t;
      c1      0 + c2
      1       1
      

      Attachments

        Activity

          People

            bar Alexander Barkov
            midenok Aleksey Midenkov
            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.