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

Redundant warnings for LEFT('a','b')

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 10.0, 10.1, 10.2
    • 10.2
    • OTHER
    • 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

      Attachments

        Activity

          People

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