Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.1, 10.0
    • Fix Version/s: 10.1
    • Component/s: OTHER
    • Labels:
      None

      Description

      PREPARE stmt FROM "SELECT LEFT('a','b')";
      SHOW WARNINGS;
      EXECUTE stmt;
      SHOW WARNINGS;
      

      returns the following:

      Query OK, 0 rows affected, 1 warning (0.00 sec)
      Statement prepared
      
      +---------+------+----------------------------------------+
      | Level   | Code | Message                                |
      +---------+------+----------------------------------------+
      | Warning | 1292 | Truncated incorrect INTEGER value: 'b' |
      +---------+------+----------------------------------------+
      1 row in set (0.00 sec)
      
      +---------------+
      | LEFT('a','b') |
      +---------------+
      |               |
      +---------------+
      1 row in set, 2 warnings (0.00 sec)
      
      +---------+------+----------------------------------------+
      | Level   | Code | Message                                |
      +---------+------+----------------------------------------+
      | Warning | 1292 | Truncated incorrect INTEGER value: 'b' |
      | Warning | 1292 | Truncated incorrect INTEGER value: 'b' |
      +---------+------+----------------------------------------+
      2 rows in set (0.00 sec)
      

      Notice, one warning is sent during PREPARE.
      Then two warnings are sent during EXECUTE:

      • one warning during fix_length_and_dec()
      • another warning during the actual query execution

      There could be less warnings.
      Serg proposed that fix_length_and_dec() could put args[1] into either of these:

      • Item_int
      • Item_cache_int
      • Item_int_with_ref

      This would fix redundant warnings and help to avoid unnecessary strtoll10() calls per every row.

      The problem is also repeatable with:

      PREPARE stmt FROM "SELECT LPAD('a','b','c')";
      SHOW WARNINGS;
      EXECUTE stmt;
      SHOW WARNINGS
      

        Gliffy Diagrams

          Attachments

            Activity

            There are no comments yet on this issue.

              People

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

                Dates

                • Created:
                  Updated: