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

POSIX collating elements are not supported

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 10.0.14
    • Fix Version/s: 10.0
    • Component/s: OTHER
    • Labels:
    • Environment:
      Ubuntu 14.04

      Description

      When running the following queries, you will get an error, which in my case breaks replication as the master is currently MySQL 5.5.40

      SELECT ' ' REGEXP '[[.space.]]';
      
      SELECT '.' REGEXP '[[.period.]]';
      

      Error:

      ERROR 1139 (42000): Got error 'POSIX collating elements are not supported at offset 1' from regexp
      

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            elenst Elena Stepanova added a comment -

            Thanks for the report.

            Alexander Barkov,
            I suppose it's a PCRE limitation, but the replication failure is very unfortunate. Is there anything we can do about it? Maybe a non-default mode or a new version which allows the syntax?

            Show
            elenst Elena Stepanova added a comment - Thanks for the report. Alexander Barkov , I suppose it's a PCRE limitation, but the replication failure is very unfortunate. Is there anything we can do about it? Maybe a non-default mode or a new version which allows the syntax?
            Hide
            bar Alexander Barkov added a comment - - edited

            The old Henry Spencer regex library supported a number of character names:
            https://mariadb.com/kb/en/mariadb/documentation/functions-and-operators/string-functions/regular-expressions-functions/regular-expressions-overview/#character-names
            This was a non-standard, non-POSIX extension in the old library.

            In POSIX regex the syntax '[[.xxx.]]' is reserved for collating elements.
            For some reasons, Henry Spencer reused the same syntax for its character names extension.

            PCRE does not support collating elements yet (but I guess it will in the future).
            Currently PCRE only recognizes this syntax and just returns an error that you can see.

            There is a number of workarounds possible:

            For space:

            SELECT ' ' REGEXP ' ';
            SELECT ' ' REGEXP '[ ]';
            SELECT ' ' REGEXP '[[:space:]]';
            SELECT ' ' REGEXP '\\{20}';
            SELECT ' ' REGEXP '\\x{20}';
            

            For dot:

            SELECT '.' REGEXP '[.]';
            SELECT '.' REGEXP '\\.';
            SELECT '.' REGEXP '\\x2E';
            SELECT '.' REGEXP '\\x{2E}';
            

            How difficult would it be to change your application to use these workarounds?

            These two are POSIX compliant and are supported by both libraries:

            SELECT ' ' REGEXP ' ';
            SELECT '.' REGEXP '[.]';
            
            Show
            bar Alexander Barkov added a comment - - edited The old Henry Spencer regex library supported a number of character names: https://mariadb.com/kb/en/mariadb/documentation/functions-and-operators/string-functions/regular-expressions-functions/regular-expressions-overview/#character-names This was a non-standard, non-POSIX extension in the old library. In POSIX regex the syntax '[ [.xxx.] ]' is reserved for collating elements. For some reasons, Henry Spencer reused the same syntax for its character names extension. PCRE does not support collating elements yet (but I guess it will in the future). Currently PCRE only recognizes this syntax and just returns an error that you can see. There is a number of workarounds possible: For space: SELECT ' ' REGEXP ' '; SELECT ' ' REGEXP '[ ]'; SELECT ' ' REGEXP '[[:space:]]'; SELECT ' ' REGEXP '\\{20}'; SELECT ' ' REGEXP '\\x{20}'; For dot: SELECT '.' REGEXP '[.]'; SELECT '.' REGEXP '\\.'; SELECT '.' REGEXP '\\x2E'; SELECT '.' REGEXP '\\x{2E}'; How difficult would it be to change your application to use these workarounds? These two are POSIX compliant and are supported by both libraries: SELECT ' ' REGEXP ' '; SELECT '.' REGEXP '[.]';
            Hide
            TheReaper Johann added a comment -

            Fortunately it will not be too difficult to change in the instance where it is causing problems.

            Show
            TheReaper Johann added a comment - Fortunately it will not be too difficult to change in the instance where it is causing problems.
            Hide
            bar Alexander Barkov added a comment -

            Thanks. I reported the issue to the PCRE team. Changing priority to minor for now.
            We'll escalate the bug if we have more related problems reported.

            Show
            bar Alexander Barkov added a comment - Thanks. I reported the issue to the PCRE team. Changing priority to minor for now. We'll escalate the bug if we have more related problems reported.
            Hide
            CmdrSharp Marcus Frolander added a comment -

            Same issue with a module for a shopping cart. Currently looking into whether or not this can be easily swapped out in the code, although since the module isn't developed internally, that's likely not going to be an all too easy task.

            Would appreciate a fix for this issue.

            Show
            CmdrSharp Marcus Frolander added a comment - Same issue with a module for a shopping cart. Currently looking into whether or not this can be easily swapped out in the code, although since the module isn't developed internally, that's likely not going to be an all too easy task. Would appreciate a fix for this issue.
            Hide
            CmdrSharp Marcus Frolander added a comment -

            Same issue with a module for a shopping cart. Currently looking into whether or not this can be easily swapped out in the code, although since the module isn't developed internally, that's likely not going to be an all too easy task.

            Would appreciate a fix for this issue.

            Show
            CmdrSharp Marcus Frolander added a comment - Same issue with a module for a shopping cart. Currently looking into whether or not this can be easily swapped out in the code, although since the module isn't developed internally, that's likely not going to be an all too easy task. Would appreciate a fix for this issue.

              People

              • Assignee:
                bar Alexander Barkov
                Reporter:
                TheReaper Johann
              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated: