diff options
author | Daniel Black <daniel@mariadb.org> | 2022-01-20 09:10:44 +1100 |
---|---|---|
committer | Daniel Black <daniel@mariadb.org> | 2022-01-20 19:01:36 +1100 |
commit | 1d27b5789aaa353175f5331d3a8b104b22dd1fce (patch) | |
tree | c44151e98eaef2977eca876d9462dd5559ebcb9b /sql/item_strfunc.h | |
parent | 810ef9117a54f8dfbd362d959d46a2322f86a9d0 (diff) | |
download | mariadb-git-1d27b5789aaa353175f5331d3a8b104b22dd1fce.tar.gz |
MDEV-27544 database() function should return 64 characters
Database names are 64 utf8 characters per the system tables
that refer to them.
The current database() function is returning 34 characters.
The result of limiting this function results to max length of 34
became apparent when used in a UNION ALL where the results are
truncated to 34 characters.
For (uninvestigated) reasons, SELECT DATABASE() on its own
would always return the right number of characters.
Thanks Alexander Barkov for the review.
Thanks dave for noticing the bug in the stackexchange post
https://dba.stackexchange.com/questions/306183/why-is-my-database-name-truncated
Diffstat (limited to 'sql/item_strfunc.h')
-rw-r--r-- | sql/item_strfunc.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 0bf21b63ac9..30464ddadb3 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -717,7 +717,7 @@ public: String *val_str(String *); bool fix_length_and_dec() { - max_length= MAX_FIELD_NAME * system_charset_info->mbmaxlen; + max_length= NAME_CHAR_LEN * system_charset_info->mbmaxlen; maybe_null=1; return FALSE; } |