mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Additional fix for BUG#16777: Can not create trigger nor view
w/o definer if --skip-grant-tables specified. The previous patch does not allow to specify empty host name in DEFINER-clause explicitly.
This commit is contained in:
@ -648,6 +648,18 @@ static const char *require_quotes(const char *name, uint name_length)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Quote the given identifier if needed and append it to the target string.
|
||||
If the given identifier is empty, it will be quoted.
|
||||
|
||||
SYNOPSIS
|
||||
append_identifier()
|
||||
thd thread handler
|
||||
packet target string
|
||||
name the identifier to be appended
|
||||
name_length length of the appending identifier
|
||||
*/
|
||||
|
||||
void
|
||||
append_identifier(THD *thd, String *packet, const char *name, uint length)
|
||||
{
|
||||
@ -701,8 +713,11 @@ append_identifier(THD *thd, String *packet, const char *name, uint length)
|
||||
length length of name
|
||||
|
||||
IMPLEMENTATION
|
||||
If name is a keyword or includes a special character, then force
|
||||
quoting.
|
||||
Force quoting in the following cases:
|
||||
- name is empty (for one, it is possible when we use this function for
|
||||
quoting user and host names for DEFINER clause);
|
||||
- name is a keyword;
|
||||
- name includes a special character;
|
||||
Otherwise identifier is quoted only if the option OPTION_QUOTE_SHOW_CREATE
|
||||
is set.
|
||||
|
||||
@ -713,7 +728,7 @@ append_identifier(THD *thd, String *packet, const char *name, uint length)
|
||||
|
||||
int get_quote_char_for_identifier(THD *thd, const char *name, uint length)
|
||||
{
|
||||
if (!length ||
|
||||
if (length &&
|
||||
!is_keyword(name,length) &&
|
||||
!require_quotes(name, length) &&
|
||||
!(thd->options & OPTION_QUOTE_SHOW_CREATE))
|
||||
|
Reference in New Issue
Block a user