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

ALTER from a bigger to a smaller blob type truncates too much data

    XMLWordPrintable

    Details

      Description

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a BLOB) ENGINE=MyISAM;
      INSERT INTO t1 VALUES (REPEAT(0x61,65000));
      SELECT LENGTH(a) FROM t1;
      ALTER TABLE t1 MODIFY a TINYBLOB;
      SELECT LENGTH(a) FROM t1;

      returns 65000 before ALTER:

      +-----------+
      | LENGTH(a) |
      +-----------+
      |     65000 |
      +-----------+

      and returns 232 after ALTER:

      +-----------+
      | LENGTH(a) |
      +-----------+
      |       232 |
      +-----------+

      This looks wrong. The expected length after ALTER is 255.

      It also does not produce any warnings on truncation. Probably it should.

        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:
                Resolved: