1
0
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:
anozdrin@mysql.com
2006-03-10 14:40:15 +03:00
parent c5493b6316
commit 3b3cb95eb9
6 changed files with 135 additions and 57 deletions

View File

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