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

Strings beginning with control characters are "less than" empty string

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Not a Bug
    • Affects Version/s: 5.5.47, 10.0.25
    • Fix Version/s: N/A
    • Component/s: Character Sets
    • Labels:
      None
    • Environment:
      openSuSE 42, CentOS 7

      Description

      Any non empty string is expected to be larger than the empty string. Contrary to this, SELECT ... WHERE textfield > '' fails where the text data begins with a control character like newline or tab.

      This affects multiple collations (tested with utf8 and latin1 standards), only binary comparison works as expected.

      Reproduce / test:

      select '\ntext' > '', strcmp('\ntext', '');
      +---------------+----------------------+
      | '\ntext' > '' | strcmp('\ntext', '') |
      +---------------+----------------------+
      |             0 |                   -1 |
      +---------------+----------------------+
      

      Any control character at the beginning of the text triggers this behaviour.

      Workaround: use BINARY or *_bin collations or compare textfield <> ''.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                serg Sergei Golubchik
                Reporter:
                balzer@expeedo.de Michael Balzer
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: