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

Change Item_func_length::print() to display octet_length() rather than length()

    XMLWordPrintable

    Details

      Description

      Currently Item_func_length::print() prints ``length()'':

      EXPLAIN EXTENDED SELECT LENGTH('a'), OCTET_LENGTH('a');
      SHOW WARNINGS;
      

      +-------+------+------------------------------------------------------------------------+
      | Level | Code | Message                                                                |
      +-------+------+------------------------------------------------------------------------+
      | Note  | 1003 | select length('a') AS `LENGTH('a')`,length('a') AS `OCTET_LENGTH('a')` |
      +-------+------+------------------------------------------------------------------------+
      

      We're going to implement MDEV-12783 soon, which will translate LENGTH() to OCTET_LENGTH() or CHAR_LENGTH() depending on sql_mode.

      To make the result of Item_func_lengt::print() unambiguously work in virtual columns independently from sql_mode, will change Item_func_length::print() to print ``octet_length()'':

      +-------+------+------------------------------------------------------------------------------------+
      | Level | Code | Message                                                                            |
      +-------+------+------------------------------------------------------------------------------------+
      | Note  | 1003 | select octet_length('a') AS `LENGTH('a')`,octet_length('a') AS `OCTET_LENGTH('a')` |
      +-------+------+------------------------------------------------------------------------------------+
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bar Alexander Barkov
              Reporter:
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration