Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • 10.4.5
    • N/A
    • N/A
    • None
    • Windows

    Description

      I have found the following problem:
      When in a SQL-Statement there is a commentline and between the '--' and the text there is no ein space, then I get the error ERROR 1064 (42000)....

      e.g.

      select *
       from information_schema.columns
      where TABLE_NAME = 'ALL_PLUGINS'
      --and data_type = 'varchar'
      ;
      

      Error:
      ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'and data_type = 'varchar'' at line 4

      select *
       from information_schema.columns
      where TABLE_NAME = 'ALL_PLUGINS'
      -- and data_type = 'varchar'
      ;
      

      then I get no error and get the correct result.

      Attachments

        Issue Links

          Activity

            alice Alice Sherepa added a comment -

            This is not a bug, a comment requires the second dash to be followed by at least one whitespace or control character (such as a space, tab, newline, and so on) (https://mariadb.com/kb/en/library/comment-syntax/ ) to prevent problems with negative numbers

            MariaDB [test]> select ---1;
            +------+
            | ---1 |
            +------+
            |   -1 |
            +------+
            1 row in set (0.00 sec)
            

            alice Alice Sherepa added a comment - This is not a bug, a comment requires the second dash to be followed by at least one whitespace or control character (such as a space, tab, newline, and so on) ( https://mariadb.com/kb/en/library/comment-syntax/ ) to prevent problems with negative numbers MariaDB [test]> select ---1; +------+ | ---1 | +------+ | -1 | +------+ 1 row in set (0.00 sec)

            For numbers, this is also the case with the Oracle database.
            Such as.

            select---123345 from dual;
            ---12 
            --------- 
            -12
            

            But if after the --a sign comes, then it's a comment. And so that is a bug. In Oracle mode at all (SET SESSION sql _ mode = ORACLE; )

            wodrsoftware Wolfgang Draxler added a comment - For numbers, this is also the case with the Oracle database. Such as. select--- 123345 from dual; --- 12 --------- - 12 But if after the --a sign comes, then it's a comment. And so that is a bug. In Oracle mode at all (SET SESSION sql _ mode = ORACLE; )
            alice Alice Sherepa added a comment -

            I am not sure what do you mean. It works the same way in Oracle mode.

            MariaDB [test]> SET SESSION sql_mode = ORACLE;
            Query OK, 0 rows affected (0.000 sec)
             
            MariaDB [test]> select ---123345 from dual;
            +-----------+
            | ---123345 |
            +-----------+
            |   -123345 |
            +-----------+
            1 row in set (0.002 sec)
             
            MariaDB [test]> select version();
            +--------------------+
            | version()          |
            +--------------------+
            | 10.4.5-MariaDB-log |
            +--------------------+
            1 row in set (0.000 sec)
             
            MariaDB [test]> select --12--6---1 from dual;
            +-------------+
            | --12--6---1 |
            +-------------+
            |          17 |
            +-------------+
            1 row in set (0.000 sec)
             
            MariaDB [test]> show variables like 'sql_mode';
            +---------------+----------------------------------------------------------------------------------------------------------------------------------------------+
            | Variable_name | Value                                                                                                                                        |
            +---------------+----------------------------------------------------------------------------------------------------------------------------------------------+
            | sql_mode      | PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER,SIMULTANEOUS_ASSIGNMENT |
            +---------------+----------------------------------------------------------------------------------------------------------------------------------------------+
            1 row in set (0.002 sec)
            

            alice Alice Sherepa added a comment - I am not sure what do you mean. It works the same way in Oracle mode. MariaDB [test]> SET SESSION sql_mode = ORACLE; Query OK, 0 rows affected (0.000 sec)   MariaDB [test]> select ---123345 from dual; +-----------+ | ---123345 | +-----------+ | -123345 | +-----------+ 1 row in set (0.002 sec)   MariaDB [test]> select version(); +--------------------+ | version() | +--------------------+ | 10.4.5-MariaDB-log | +--------------------+ 1 row in set (0.000 sec)   MariaDB [test]> select --12--6---1 from dual; +-------------+ | --12--6---1 | +-------------+ | 17 | +-------------+ 1 row in set (0.000 sec)   MariaDB [test]> show variables like 'sql_mode'; +---------------+----------------------------------------------------------------------------------------------------------------------------------------------+ | Variable_name | Value | +---------------+----------------------------------------------------------------------------------------------------------------------------------------------+ | sql_mode | PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER,SIMULTANEOUS_ASSIGNMENT | +---------------+----------------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.002 sec)

            by numbers works MariaDB and Oralce equal. That ist correct.
            e.g.

            select ---123345 from dual;
            

            But what I mean is, that by characters is not equal
            by my e.g.

            --and data_type = 'varchar'
            

            by MariaDB I get the error "ERROR 1064 (42000): ...."

            by Oracle I get no error, because oracle interpret this is as a comment

            wodrsoftware Wolfgang Draxler added a comment - by numbers works MariaDB and Oralce equal. That ist correct. e.g. select --- 123345 from dual; But what I mean is, that by characters is not equal by my e.g. --and data_type = 'varchar' by MariaDB I get the error "ERROR 1064 (42000): ...." by Oracle I get no error, because oracle interpret this is as a comment
            alice Alice Sherepa added a comment -

            I see, you are right. There is a task to implement it - MDEV-12087.

            alice Alice Sherepa added a comment - I see, you are right. There is a task to implement it - MDEV-12087 .

            Thank you.

            wodrsoftware Wolfgang Draxler added a comment - Thank you.

            People

              Unassigned Unassigned
              wodrsoftware Wolfgang Draxler
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.