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

NAME_CONST with NULL argument produces unexpected error message

Details

    Description

      MySQL manual says that NAME_CONST is for internal use only; MariaDB's doesn't. However, both MySQL and MariaDB allow it to be used with "normal" arguments:

      MariaDB [test]> select NAME_CONST('foo','bar');
      +------+
      | foo  |
      +------+
      | bar  |
      +------+
      1 row in set (0.00 sec)
      

      but both suddenly return "for internal use error" when the first argument is NULL:

      MariaDB [test]> select NAME_CONST(NULL,'bar');
      ERROR 1382 (HY000): The 'NAME_CONST' syntax is reserved for purposes internal to the MariaDB server
      

      It appears to be inconsistent, I would expect the error about wrong first argument (as it's supposed to be a valid identifier and naturally shouldn't be NULL).

      Attachments

        Activity

          amanjain5221 Aman Jain added a comment -

          Ok. Thanks.

          amanjain5221 Aman Jain added a comment - Ok. Thanks.

          Ok, I've documented that it's for internal use only.

          serg Sergei Golubchik added a comment - Ok, I've documented that it's for internal use only.

          Feel free to move it to documentation, the KB doesn't say it's for internal usage (https://mariadb.com/kb/en/library/name_const/) . I know that it is only because the MySQL manual says so.

          I do think that if a function is available, it should behave, but I agree it might be not worth spending time on.

          elenst Elena Stepanova added a comment - Feel free to move it to documentation, the KB doesn't say it's for internal usage ( https://mariadb.com/kb/en/library/name_const/ ) . I know that it is only because the MySQL manual says so. I do think that if a function is available, it should behave, but I agree it might be not worth spending time on.

          I think it's not worth fixing. The error is correct, NAME_CONST is for internal usage only. As it should never be specified manually, and nothing bad happens when it is, I'd keep the behavior as is.

          serg Sergei Golubchik added a comment - I think it's not worth fixing. The error is correct, NAME_CONST is for internal usage only. As it should never be specified manually, and nothing bad happens when it is, I'd keep the behavior as is.
          amanjain5221 Aman Jain added a comment - - edited

          Hello elenst, I want to take up the issue.
          What error message should I print in such a case? Is there any pre-defined error message in <sql/share/errmsg-utf8.txt> or do I have to create a new error code as ER_FIRST_ARGUMENT_CANT_NULL.

          Thanks

          amanjain5221 Aman Jain added a comment - - edited Hello elenst , I want to take up the issue. What error message should I print in such a case? Is there any pre-defined error message in <sql/share/errmsg-utf8.txt> or do I have to create a new error code as ER_FIRST_ARGUMENT_CANT_NULL. Thanks

          People

            serg Sergei Golubchik
            elenst Elena Stepanova
            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.