summaryrefslogtreecommitdiff
path: root/sql/sql_view.cc
diff options
context:
space:
mode:
authorunknown <anozdrin@mysql.com>2006-03-01 14:13:07 +0300
committerunknown <anozdrin@mysql.com>2006-03-01 14:13:07 +0300
commita44a924a407ae1f1135a14ee750468e6fc88d9b0 (patch)
treebaf54f335b2a6ccc3c2d1da9406e0832ddb6c26b /sql/sql_view.cc
parent2efabfd11a6fa5621c851a472c076e4ef5184d6d (diff)
downloadmariadb-git-a44a924a407ae1f1135a14ee750468e6fc88d9b0.tar.gz
Fix for BUG#16266: Definer is not fully qualified error during replication.
The idea of the fix is to extend support of non-SUID triggers for backward compatibility. Formerly non-SUID triggers were appeared when "new" server is being started against "old" database. Now, they are also created when "new" slave receives updates from "old" master. mysql-test/r/rpl_trigger.result: Updated the result file with the results of the test for BUG#16266. mysql-test/t/rpl_trigger.test: Added the test case for BUG#16266. sql/mysql_priv.h: Added an utility operation to be used from sql_yacc.yy. sql/sql_parse.cc: Add a utility operation to be used from sql_yacc.yy. sql/sql_trigger.cc: Extend support of non-SUID triggers. sql/sql_view.cc: Initialize LEX::definer if DEFINER-clause is missing. sql/sql_yacc.yy: Extended support of non-SUID triggers. mysql-test/std_data/bug16266.000001: A new binlog file for testing a patch for BUG#16266.
Diffstat (limited to 'sql/sql_view.cc')
-rw-r--r--sql/sql_view.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 4f62a80cfd4..2178b5d00a8 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -208,6 +208,26 @@ bool mysql_create_view(THD *thd,
if (mode != VIEW_CREATE_NEW)
sp_cache_invalidate();
+ if (!lex->definer)
+ {
+ /*
+ DEFINER-clause is missing; we have to create default definer in
+ persistent arena to be PS/SP friendly.
+ */
+
+ Query_arena original_arena;
+ Query_arena *ps_arena = thd->activate_stmt_arena_if_needed(&original_arena);
+
+ if (!(lex->definer= create_default_definer(thd)))
+ res= TRUE;
+
+ if (ps_arena)
+ thd->restore_active_arena(ps_arena, &original_arena);
+
+ if (res)
+ goto err;
+ }
+
#ifndef NO_EMBEDDED_ACCESS_CHECKS
/*
check definer of view: