[MDEV-14896] NAME_CONST with NULL argument produces unexpected error message Created: 2018-01-08  Updated: 2018-03-08  Resolved: 2018-03-08

Status: Closed
Project: MariaDB Server
Component/s: Server
Affects Version/s: 5.5, 10.0, 10.1, 10.2
Fix Version/s: N/A

Type: Bug Priority: Trivial
Reporter: Elena Stepanova Assignee: Sergei Golubchik
Resolution: Won't Fix Votes: 0
Labels: beginner-friendly, upstream


 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).



 Comments   
Comment by Aman Jain [ 2018-03-07 ]

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

Comment by Sergei Golubchik [ 2018-03-08 ]

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.

Comment by Elena Stepanova [ 2018-03-08 ]

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.

Comment by Sergei Golubchik [ 2018-03-08 ]

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

Comment by Aman Jain [ 2018-03-08 ]

Ok. Thanks.

Generated at Thu Feb 08 08:17:07 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.