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

Please add a warning when max_sort_length is reached.

    XMLWordPrintable

Details

    • Task
    • Status: In Review (View Workflow)
    • Major
    • Resolution: Unresolved
    • 11.6
    • Server
    • None

    Description

      Hi,

      this is to report upstream feature request Bug#105911 [1] for MariaDB.

      [1]: https://bugs.mysql.com/bug.php?id=105911

      This FR is to add a warning when the max_sort_length limit is reached.

      As shown below for 10.6.5 (same for 10.5.13), there are no warning when the limit is reached.

      Many thanks for looking into this,

      Jean-François Gagné

      # Create a sandbox.
      dbdeployer deploy single mariadb_10.6.5
       
      # max_sort_length is 1024 by default.
      ./use -N <<< "show global variables like 'max_sort_length'"
      max_sort_length 1024
       
      # Initialize the sandbox.
      ./use <<< "
        CREATE DATABASE test_jfg;
        CREATE TABLE test_jfg.t (
          id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
          v VARCHAR(5000))"
       
      # Add rows on both sides of the limit.
      for i in 1020 1024; do
        for j in 2 4 6 1 3 5; do ./use test_jfg <<< "INSERT INTO t(v) VALUES('$(yes | head -n $i | paste -s -d "")$j')"; done
      done
       
      # No warnings even if the ORDER BY is not fully honored.
      mysql [localhost:10605] {msandbox} (test_jfg) > SELECT SUBSTRING(v, 1020) FROM t ORDER BY v;
      +--------------------+
      | SUBSTRING(v, 1020) |
      +--------------------+
      | y1                 |
      | y2                 |
      | y3                 |
      | y4                 |
      | y5                 |
      | y6                 |
      | yyyyy2             |
      | yyyyy4             |
      | yyyyy6             |
      | yyyyy1             |
      | yyyyy3             |
      | yyyyy5             |
      +--------------------+
      12 rows in set (0.000 sec)
       
      # I would expect a warning similar to this.
      mysql [localhost:10605] {msandbox} (test_jfg) > SELECT "1a" + 2;
      +----------+
      | "1a" + 2 |
      +----------+
      |        3 |
      +----------+
      1 row in set, 1 warning (0.000 sec)
       
      mysql [localhost:10605] {msandbox} (test_jfg) > show warnings;
      +---------+------+----------------------------------------+
      | Level   | Code | Message                                |
      +---------+------+----------------------------------------+
      | Warning | 1292 | Truncated incorrect DOUBLE value: '1a' |
      +---------+------+----------------------------------------+
      1 row in set (0.000 sec)
      

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            jeanfrancois.gagne Jean-François Gagné
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.