Below is the list of changes that have just been committed into a local
6.0 repository of gluh. When gluh does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-11-06 15:53:27+04:00, gluh@stripped +9 -0
WL#3732 Information schema optimization(addon)
fill_schema_table_from_frm():
1. remove open_table_from_share() call
2. I_S TRIGGERS, open TRG file only
3. I_S VIEWS fields(except IS_UPDATABLE) use OPEN_FRM_ONLY method
mysql-test/r/trigger-compat.result@stripped, 2007-11-06 15:53:24+04:00, gluh@stripped +0 -2
result fix
mysql-test/r/trigger-grant.result@stripped, 2007-11-06 15:53:24+04:00, gluh@stripped +0 -4
result fix
sql/mysql_priv.h@stripped, 2007-11-06 15:53:25+04:00, gluh@stripped +4 -0
open_new_frm() decalaration
sql/sql_base.cc@stripped, 2007-11-06 15:53:25+04:00, gluh@stripped +1 -5
changed open_new_frm() to global
sql/sql_parse.cc@stripped, 2007-11-06 15:53:25+04:00, gluh@stripped +1 -1
tables->table->s can be 0, I_S.TRIGGERS, added check
sql/sql_show.cc@stripped, 2007-11-06 15:53:25+04:00, gluh@stripped +150 -103
fill_schema_table_from_frm():
1. remove open_table_from_share() call
2. I_S TRIGGERS, open TRG file only
3. I_S VIEWS fields(except IS_UPDATABLE) use OPEN_FRM_ONLY method
sql/sql_trigger.cc@stripped, 2007-11-06 15:53:25+04:00, gluh@stripped +11 -11
skip warning if thd->no_warnings_for_error is enabled
sql/sql_view.cc@stripped, 2007-11-06 15:53:25+04:00, gluh@stripped +10 -7
view definition context is initialized before exit
(if view is parsed with OPEN_VIEW_NO_PARSE flag)
sql/unireg.h@stripped, 2007-11-06 15:53:25+04:00, gluh@stripped +5 -0
added new flag
diff -Nrup a/mysql-test/r/trigger-compat.result b/mysql-test/r/trigger-compat.result
--- a/mysql-test/r/trigger-compat.result 2007-06-28 22:34:47 +05:00
+++ b/mysql-test/r/trigger-compat.result 2007-11-06 15:53:24 +04:00
@@ -28,8 +28,6 @@ SELECT trigger_name, definer FROM INFORM
trigger_name definer
wl2818_trg1
wl2818_trg2 mysqltest_dfn@localhost
-Warnings:
-Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'wl2818_trg1'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
diff -Nrup a/mysql-test/r/trigger-grant.result b/mysql-test/r/trigger-grant.result
--- a/mysql-test/r/trigger-grant.result 2007-07-22 16:16:27 +05:00
+++ b/mysql-test/r/trigger-grant.result 2007-11-06 15:53:24 +04:00
@@ -165,8 +165,6 @@ trg2 @
trg3 @abc@def@@
trg4 @hostname
trg5 @abcdef@@@hostname
-Warnings:
-Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'trg1'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.
SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
@@ -180,8 +178,6 @@ NULL mysqltest_db1 trg5 DELETE NULL mysq
DROP USER mysqltest_dfn@localhost;
DROP USER mysqltest_inv@localhost;
DROP DATABASE mysqltest_db1;
-Warnings:
-Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'trg1'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger.
DELETE FROM mysql.user WHERE User LIKE 'mysqltest_%';
DELETE FROM mysql.db WHERE User LIKE 'mysqltest_%';
DELETE FROM mysql.tables_priv WHERE User LIKE 'mysqltest_%';
diff -Nrup a/sql/mysql_priv.h b/sql/mysql_priv.h
--- a/sql/mysql_priv.h 2007-10-29 11:44:57 +04:00
+++ b/sql/mysql_priv.h 2007-11-06 15:53:25 +04:00
@@ -1200,6 +1200,10 @@ bool reopen_tables(THD *thd,bool get_loc
void close_data_files_and_morph_locks(THD *thd, const char *db,
const char *table_name);
void close_handle_and_leave_table_as_lock(TABLE *table);
+bool open_new_frm(THD *thd, TABLE_SHARE *share, const char *alias,
+ uint db_stat, uint prgflag,
+ uint ha_open_flags, TABLE *outparam,
+ TABLE_LIST *table_desc, MEM_ROOT *mem_root);
bool wait_for_tables(THD *thd);
bool table_is_used(TABLE *table, bool wait_for_name_lock);
TABLE *drop_locked_tables(THD *thd,const char *db, const char *table_name);
diff -Nrup a/sql/sql_base.cc b/sql/sql_base.cc
--- a/sql/sql_base.cc 2007-10-29 11:44:58 +04:00
+++ b/sql/sql_base.cc 2007-11-06 15:53:25 +04:00
@@ -99,10 +99,6 @@ static int open_unireg_entry(THD *thd, T
char *cache_key, uint cache_key_length,
MEM_ROOT *mem_root, uint flags);
static void free_cache_entry(TABLE *entry);
-static bool open_new_frm(THD *thd, TABLE_SHARE *share, const char *alias,
- uint db_stat, uint prgflag,
- uint ha_open_flags, TABLE *outparam,
- TABLE_LIST *table_desc, MEM_ROOT *mem_root);
static void close_old_data_files(THD *thd, TABLE *table, bool morph_locks,
bool send_refresh);
static bool
@@ -7383,7 +7379,7 @@ int init_ftfuncs(THD *thd, SELECT_LEX *s
mem_root temporary MEM_ROOT for parsing
*/
-static bool
+bool
open_new_frm(THD *thd, TABLE_SHARE *share, const char *alias,
uint db_stat, uint prgflag,
uint ha_open_flags, TABLE *outparam, TABLE_LIST *table_desc,
diff -Nrup a/sql/sql_parse.cc b/sql/sql_parse.cc
--- a/sql/sql_parse.cc 2007-10-29 11:30:23 +04:00
+++ b/sql/sql_parse.cc 2007-11-06 15:53:25 +04:00
@@ -4856,7 +4856,7 @@ check_table_access(THD *thd, ulong want_
}
if (tables->derived ||
- (tables->table && (int)tables->table->s->tmp_table))
+ (tables->table && tables->table->s && (int)tables->table->s->tmp_table))
continue;
thd->security_ctx= sctx;
if ((sctx->master_access & want_access) ==
diff -Nrup a/sql/sql_show.cc b/sql/sql_show.cc
--- a/sql/sql_show.cc 2007-10-25 12:39:55 +05:00
+++ b/sql/sql_show.cc 2007-11-06 15:53:25 +04:00
@@ -955,7 +955,7 @@ static void append_directory(THD *thd, S
#define LIST_PROCESS_HOST_LEN 64
-static bool get_field_default_value(THD *thd, TABLE *table,
+static bool get_field_default_value(THD *thd, Field *timestamp_field,
Field *field, String *def_value,
bool quoted)
{
@@ -966,8 +966,8 @@ static bool get_field_default_value(THD
We are using CURRENT_TIMESTAMP instead of NOW because it is
more standard
*/
- has_now_default= table->timestamp_field == field &&
- field->unireg_check != Field::TIMESTAMP_UN_FIELD;
+ has_now_default= (timestamp_field == field &&
+ field->unireg_check != Field::TIMESTAMP_UN_FIELD);
has_default= (field->type() != FIELD_TYPE_BLOB &&
!(field->flags & NO_DEFAULT_VALUE_FLAG) &&
@@ -1168,7 +1168,8 @@ int store_create_info(THD *thd, TABLE_LI
packet->append(STRING_WITH_LEN(" DYNAMIC */"));
}
}
- if (get_field_default_value(thd, table, field, &def_value, 1))
+ if (get_field_default_value(thd, table->timestamp_field,
+ field, &def_value, 1))
{
packet->append(STRING_WITH_LEN(" DEFAULT "));
packet->append(def_value.ptr(), def_value.length(), system_charset_info);
@@ -3024,12 +3025,13 @@ static uint get_table_open_method(TABLE_
open_tables function for this table
*/
-static int fill_schema_table_from_frm(THD *thd,TABLE *table,
+static int fill_schema_table_from_frm(THD *thd,TABLE_LIST *tables,
ST_SCHEMA_TABLE *schema_table,
LEX_STRING *db_name,
LEX_STRING *table_name,
enum enum_schema_tables schema_table_idx)
{
+ TABLE *table= tables->table;
TABLE_SHARE *share;
TABLE tbl;
TABLE_LIST table_list;
@@ -3043,6 +3045,23 @@ static int fill_schema_table_from_frm(TH
table_list.table_name= table_name->str;
table_list.db= db_name->str;
+
+ if (schema_table->i_s_requested_object & OPEN_TRIGGER_ONLY)
+ {
+ init_sql_alloc(&tbl.mem_root, TABLE_ALLOC_BLOCK_SIZE, 0);
+ if (!Table_triggers_list::check_n_load(thd, db_name->str,
+ table_name->str, &tbl, 1))
+ {
+ table_list.table= &tbl;
+ res= schema_table->process_table(thd, &table_list, table,
+ res, db_name, table_name);
+ delete tbl.triggers;
+ }
+ free_root(&tbl.mem_root, MYF(0));
+ thd->clear_error();
+ return res;
+ }
+
key_length= create_table_def_key(thd, key, &table_list, 0);
pthread_mutex_lock(&LOCK_open);
share= get_table_share(thd, &table_list, key,
@@ -3072,20 +3091,27 @@ static int fill_schema_table_from_frm(TH
}
}
- if (share->is_view ||
- !(res= open_table_from_share(thd, share, table_name->str, 0,
- (READ_KEYINFO | COMPUTE_TYPES |
- DONT_GIVE_ERROR |
- EXTRA_RECORD | OPEN_FRM_FILE_ONLY),
- thd->open_options, &tbl, OTM_OPEN)))
+ if (share->is_view)
+ {
+ if (open_new_frm(thd, share, table_name->str,
+ (uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE |
+ HA_GET_INDEX | HA_TRY_READ_ONLY),
+ READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD |
+ OPEN_VIEW_NO_PARSE,
+ thd->open_options, &tbl, &table_list, thd->mem_root))
+ goto err1;
+ table_list.view= (st_lex*) share->is_view;
+ res= schema_table->process_table(thd, &table_list, table,
+ res, db_name, table_name);
+ goto err1;
+ }
+
{
tbl.s= share;
table_list.table= &tbl;
table_list.view= (st_lex*) share->is_view;
res= schema_table->process_table(thd, &table_list, table,
res, db_name, table_name);
- closefrm(&tbl, true);
- goto err;
}
err1:
@@ -3155,6 +3181,10 @@ int get_all_tables(THD *thd, TABLE_LIST
*/
thd->reset_n_backup_open_tables_state(&open_tables_state_backup);
+ schema_table_idx= get_schema_table_idx(schema_table);
+ tables->table_open_method= table_open_method=
+ get_table_open_method(tables, schema_table, schema_table_idx);
+ DBUG_PRINT("open_method", ("%d", tables->table_open_method));
/*
this branch processes SHOW FIELDS, SHOW INDEXES commands.
see sql_parse.cc, prepare_schema_table() function where
@@ -3167,7 +3197,6 @@ int get_all_tables(THD *thd, TABLE_LIST
goto err;
}
- schema_table_idx= get_schema_table_idx(schema_table);
if (get_lookup_field_values(thd, cond, tables, &lookup_field_vals))
{
error= 0;
@@ -3205,9 +3234,6 @@ int get_all_tables(THD *thd, TABLE_LIST
else
partial_cond= make_cond_for_info_schema(cond, tables);
- tables->table_open_method= table_open_method=
- get_table_open_method(tables, schema_table, schema_table_idx);
-
if (lex->describe)
{
/* EXPLAIN SELECT */
@@ -3273,10 +3299,10 @@ int get_all_tables(THD *thd, TABLE_LIST
}
else
{
- if (!(table_open_method & ~OPEN_FRM_ONLY) &&
+ if (!(table_open_method & ~OPEN_FRM_ONLY) &&
!with_i_schema)
{
- if (!fill_schema_table_from_frm(thd, table, schema_table, db_name,
+ if (!fill_schema_table_from_frm(thd, tables, schema_table, db_name,
table_name, schema_table_idx))
continue;
}
@@ -3758,7 +3784,8 @@ static int get_schema_column_record(THD
const char *wild= lex->wild ? lex->wild->ptr() : NullS;
CHARSET_INFO *cs= system_charset_info;
TABLE *show_table;
- Field **ptr,*field;
+ TABLE_SHARE *show_table_share;
+ Field **ptr, *field, *timestamp_field;
int count;
DBUG_ENTER("get_schema_column_record");
@@ -3779,17 +3806,49 @@ static int get_schema_column_record(THD
}
show_table= tables->table;
+ show_table_share= show_table->s;
count= 0;
- restore_record(show_table, s->default_values);
- show_table->use_all_columns(); // Required for default
- for (ptr= show_table->field; (field= *ptr) ; ptr++)
+ if (tables->view || tables->schema_table)
+ {
+ ptr= show_table->field;
+ timestamp_field= show_table->timestamp_field;
+ show_table->use_all_columns(); // Required for default
+ }
+ else
+ {
+ ptr= show_table_share->field;
+ timestamp_field= show_table_share->timestamp_field;
+ /*
+ read_set may be inited in case of
+ temporary table
+ */
+ if (!show_table->read_set)
+ {
+ /* to satisfy 'field->val_str' ASSERTs */
+ uchar *bitmaps;
+ uint bitmap_size= show_table_share->column_bitmap_size;
+ if (!(bitmaps= (uchar*) alloc_root(thd->mem_root, bitmap_size)))
+ DBUG_RETURN(0);
+ bitmap_init(&show_table->def_read_set,
+ (my_bitmap_map*) bitmaps, show_table_share->fields, FALSE);
+ bitmap_set_all(&show_table->def_read_set);
+ show_table->read_set= &show_table->def_read_set;
+ }
+ bitmap_set_all(show_table->read_set);
+ }
+
+ for (; (field= *ptr) ; ptr++)
{
uchar *pos;
char tmp[MAX_FIELD_WIDTH];
String type(tmp,sizeof(tmp), system_charset_info);
char *end;
+ /* to satisfy 'field->val_str' ASSERTs */
+ field->table= show_table;
+ show_table->in_use= thd;
+
if (wild && wild[0] &&
wild_case_compare(system_charset_info, field->field_name,wild))
continue;
@@ -3825,7 +3884,7 @@ static int get_schema_column_record(THD
cs);
table->field[4]->store((longlong) count, TRUE);
- if (get_field_default_value(thd, show_table, field, &type, 0))
+ if (get_field_default_value(thd, timestamp_field, field, &type, 0))
{
table->field[5]->store(type.ptr(), type.length(), cs);
table->field[5]->set_notnull();
@@ -4482,24 +4541,15 @@ static int get_schema_views_record(THD *
LEX_STRING *table_name)
{
CHARSET_INFO *cs= system_charset_info;
- DBUG_ENTER("get_schema_views_record");
- LEX_STRING *tmp_db_name, *tmp_table_name;
char definer[USER_HOST_BUFF_SIZE];
uint definer_len;
bool updatable_view;
- /*
- if SELECT FROM I_S.VIEWS uses only fields
- which have OPEN_FRM_ONLY flag then 'tables'
- structure is zeroed and only tables->view is set.
- (see fill_schema_table_from_frm() function).
- So we should disable other fields filling.
- */
- bool only_share= !tables->definer.user.str;
+ DBUG_ENTER("get_schema_views_record");
if (tables->view)
{
Security_context *sctx= thd->security_ctx;
- if (!only_share && !tables->allowed_show)
+ if (!tables->allowed_show)
{
if (!my_strcasecmp(system_charset_info, tables->definer.user.str,
sctx->priv_user) &&
@@ -4508,34 +4558,29 @@ static int get_schema_views_record(THD *
tables->allowed_show= TRUE;
}
restore_record(table, s->default_values);
- tmp_db_name= &tables->view_db;
- tmp_table_name= &tables->view_name;
- if (only_share)
+ table->field[1]->store(db_name->str, db_name->length, cs);
+ table->field[2]->store(table_name->str, table_name->length, cs);
+
+ if (tables->allowed_show)
{
- tmp_db_name= db_name;
- tmp_table_name= table_name;
+ table->field[3]->store(tables->view_body_utf8.str,
+ tables->view_body_utf8.length,
+ cs);
}
- table->field[1]->store(tmp_db_name->str, tmp_db_name->length, cs);
- table->field[2]->store(tmp_table_name->str, tmp_table_name->length, cs);
- if (!only_share)
- {
- if (tables->allowed_show)
- {
- table->field[3]->store(tables->view_body_utf8.str,
- tables->view_body_utf8.length,
- cs);
- }
- if (tables->with_check != VIEW_CHECK_NONE)
- {
- if (tables->with_check == VIEW_CHECK_LOCAL)
- table->field[4]->store(STRING_WITH_LEN("LOCAL"), cs);
- else
- table->field[4]->store(STRING_WITH_LEN("CASCADED"), cs);
- }
+ if (tables->with_check != VIEW_CHECK_NONE)
+ {
+ if (tables->with_check == VIEW_CHECK_LOCAL)
+ table->field[4]->store(STRING_WITH_LEN("LOCAL"), cs);
else
- table->field[4]->store(STRING_WITH_LEN("NONE"), cs);
+ table->field[4]->store(STRING_WITH_LEN("CASCADED"), cs);
+ }
+ else
+ table->field[4]->store(STRING_WITH_LEN("NONE"), cs);
+ if (table->pos_in_table_list->table_open_method &
+ OPEN_FULL_TABLE)
+ {
updatable_view= 0;
if (tables->algorithm != VIEW_ALGORITHM_TMPTABLE)
{
@@ -4569,24 +4614,26 @@ static int get_schema_views_record(THD *
table->field[5]->store(STRING_WITH_LEN("YES"), cs);
else
table->field[5]->store(STRING_WITH_LEN("NO"), cs);
- definer_len= (strxmov(definer, tables->definer.user.str, "@",
- tables->definer.host.str, NullS) - definer);
- table->field[6]->store(definer, definer_len, cs);
- if (tables->view_suid)
- table->field[7]->store(STRING_WITH_LEN("DEFINER"), cs);
- else
- table->field[7]->store(STRING_WITH_LEN("INVOKER"), cs);
-
- table->field[8]->store(tables->view_creation_ctx->get_client_cs()->csname,
- strlen(tables->view_creation_ctx->
- get_client_cs()->csname), cs);
-
- table->field[9]->store(tables->view_creation_ctx->
- get_connection_cl()->name,
- strlen(tables->view_creation_ctx->
- get_connection_cl()->name), cs);
}
+ definer_len= (strxmov(definer, tables->definer.user.str, "@",
+ tables->definer.host.str, NullS) - definer);
+ table->field[6]->store(definer, definer_len, cs);
+ if (tables->view_suid)
+ table->field[7]->store(STRING_WITH_LEN("DEFINER"), cs);
+ else
+ table->field[7]->store(STRING_WITH_LEN("INVOKER"), cs);
+
+ table->field[8]->store(tables->view_creation_ctx->get_client_cs()->csname,
+ strlen(tables->view_creation_ctx->
+ get_client_cs()->csname), cs);
+
+ table->field[9]->store(tables->view_creation_ctx->
+ get_connection_cl()->name,
+ strlen(tables->view_creation_ctx->
+ get_connection_cl()->name), cs);
+
+
if (schema_table_store_record(thd, table))
DBUG_RETURN(1);
if (res && thd->net.last_errno)
@@ -6454,15 +6501,15 @@ ST_FIELD_INFO view_fields_info[]=
{"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FRM_ONLY},
{"TABLE_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
{"TABLE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
- {"VIEW_DEFINITION", 65535, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"CHECK_OPTION", 8, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"VIEW_DEFINITION", 65535, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
+ {"CHECK_OPTION", 8, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
{"IS_UPDATABLE", 3, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"DEFINER", 77, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"SECURITY_TYPE", 7, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"DEFINER", 77, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
+ {"SECURITY_TYPE", 7, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
{"CHARACTER_SET_CLIENT", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, 0,
- OPEN_FULL_TABLE},
+ OPEN_FRM_ONLY},
{"COLLATION_CONNECTION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, 0,
- OPEN_FULL_TABLE},
+ OPEN_FRM_ONLY},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
};
@@ -6577,38 +6624,38 @@ ST_FIELD_INFO open_tables_fields_info[]=
ST_FIELD_INFO triggers_fields_info[]=
{
- {"TRIGGER_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE},
- {"TRIGGER_SCHEMA",NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"TRIGGER_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FRM_ONLY},
+ {"TRIGGER_SCHEMA",NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
{"TRIGGER_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Trigger",
- OPEN_FULL_TABLE},
- {"EVENT_MANIPULATION", 6, MYSQL_TYPE_STRING, 0, 0, "Event", OPEN_FULL_TABLE},
+ OPEN_FRM_ONLY},
+ {"EVENT_MANIPULATION", 6, MYSQL_TYPE_STRING, 0, 0, "Event", OPEN_FRM_ONLY},
{"EVENT_OBJECT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0,
- OPEN_FULL_TABLE},
+ OPEN_FRM_ONLY},
{"EVENT_OBJECT_SCHEMA",NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
- OPEN_FULL_TABLE},
+ OPEN_FRM_ONLY},
{"EVENT_OBJECT_TABLE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Table",
- OPEN_FULL_TABLE},
- {"ACTION_ORDER", 4, MYSQL_TYPE_LONGLONG, 0, 0, 0, OPEN_FULL_TABLE},
- {"ACTION_CONDITION", 65535, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE},
+ OPEN_FRM_ONLY},
+ {"ACTION_ORDER", 4, MYSQL_TYPE_LONGLONG, 0, 0, 0, OPEN_FRM_ONLY},
+ {"ACTION_CONDITION", 65535, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FRM_ONLY},
{"ACTION_STATEMENT", 65535, MYSQL_TYPE_STRING, 0, 0, "Statement",
- OPEN_FULL_TABLE},
- {"ACTION_ORIENTATION", 9, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"ACTION_TIMING", 6, MYSQL_TYPE_STRING, 0, 0, "Timing", OPEN_FULL_TABLE},
+ OPEN_FRM_ONLY},
+ {"ACTION_ORIENTATION", 9, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
+ {"ACTION_TIMING", 6, MYSQL_TYPE_STRING, 0, 0, "Timing", OPEN_FRM_ONLY},
{"ACTION_REFERENCE_OLD_TABLE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0,
- OPEN_FULL_TABLE},
+ OPEN_FRM_ONLY},
{"ACTION_REFERENCE_NEW_TABLE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, 0,
- OPEN_FULL_TABLE},
- {"ACTION_REFERENCE_OLD_ROW", 3, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"ACTION_REFERENCE_NEW_ROW", 3, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
- {"CREATED", 0, MYSQL_TYPE_DATETIME, 0, 1, "Created", OPEN_FULL_TABLE},
- {"SQL_MODE", 65535, MYSQL_TYPE_STRING, 0, 0, "sql_mode", OPEN_FULL_TABLE},
- {"DEFINER", 65535, MYSQL_TYPE_STRING, 0, 0, "Definer", OPEN_FULL_TABLE},
+ OPEN_FRM_ONLY},
+ {"ACTION_REFERENCE_OLD_ROW", 3, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
+ {"ACTION_REFERENCE_NEW_ROW", 3, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
+ {"CREATED", 0, MYSQL_TYPE_DATETIME, 0, 1, "Created", OPEN_FRM_ONLY},
+ {"SQL_MODE", 65535, MYSQL_TYPE_STRING, 0, 0, "sql_mode", OPEN_FRM_ONLY},
+ {"DEFINER", 65535, MYSQL_TYPE_STRING, 0, 0, "Definer", OPEN_FRM_ONLY},
{"CHARACTER_SET_CLIENT", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0,
- "character_set_client", OPEN_FULL_TABLE},
+ "character_set_client", OPEN_FRM_ONLY},
{"COLLATION_CONNECTION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0,
- "collation_connection", OPEN_FULL_TABLE},
+ "collation_connection", OPEN_FRM_ONLY},
{"DATABASE_COLLATION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0,
- "Database Collation", OPEN_FULL_TABLE},
+ "Database Collation", OPEN_FRM_ONLY},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
};
@@ -6879,7 +6926,7 @@ ST_SCHEMA_TABLE schema_tables[]=
fill_schema_table_privileges, 0, 0, -1, -1, 0, 0},
{"TRIGGERS", triggers_fields_info, create_schema_table,
get_all_tables, make_old_format, get_schema_triggers_record, 5, 6, 0,
- OPEN_TABLE_ONLY},
+ OPEN_TRIGGER_ONLY|OPTIMIZE_I_S_TABLE},
{"USER_PRIVILEGES", user_privileges_fields_info, create_schema_table,
fill_schema_user_privileges, 0, 0, -1, -1, 0, 0},
{"VARIABLES", variables_fields_info, create_schema_table, fill_variables,
diff -Nrup a/sql/sql_trigger.cc b/sql/sql_trigger.cc
--- a/sql/sql_trigger.cc 2007-09-05 03:57:10 +05:00
+++ b/sql/sql_trigger.cc 2007-11-06 15:53:25 +04:00
@@ -1152,12 +1152,12 @@ bool Table_triggers_list::check_n_load(T
DBUG_RETURN(1); // EOM
}
-
- push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_TRG_NO_CREATION_CTX,
- ER(ER_TRG_NO_CREATION_CTX),
- (const char*) db,
- (const char*) table_name);
+ if (!thd->no_warnings_for_error)
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_TRG_NO_CREATION_CTX,
+ ER(ER_TRG_NO_CREATION_CTX),
+ (const char*) db,
+ (const char*) table_name);
if (!(trg_client_cs_name= alloc_lex_string(&table->mem_root)) ||
!(trg_connection_cl_name= alloc_lex_string(&table->mem_root)) ||
@@ -1284,11 +1284,11 @@ bool Table_triggers_list::check_n_load(T
MySQL, which does not support triggers definers. We should emit
warning here.
*/
-
- push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_TRG_NO_DEFINER, ER(ER_TRG_NO_DEFINER),
- (const char*) db,
- (const char*) lex.sphead->m_name.str);
+ if (!thd->no_warnings_for_error)
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_TRG_NO_DEFINER, ER(ER_TRG_NO_DEFINER),
+ (const char*) db,
+ (const char*) lex.sphead->m_name.str);
/*
Set definer to the '' to correct displaying in the information
diff -Nrup a/sql/sql_view.cc b/sql/sql_view.cc
--- a/sql/sql_view.cc 2007-10-04 17:22:08 +05:00
+++ b/sql/sql_view.cc 2007-11-06 15:53:25 +04:00
@@ -1014,8 +1014,18 @@ bool mysql_make_view(THD *thd, File_pars
table->db, table->table_name);
get_default_definer(thd, &table->definer);
}
+
+ /*
+ Initialize view definition context by character set names loaded from
+ the view definition file. Use UTF8 character set if view definition
+ file is of old version and does not contain the character set names.
+ */
+ table->view_creation_ctx= View_creation_ctx::create(thd, table);
+
if (flags & OPEN_VIEW_NO_PARSE)
{
+ if (arena)
+ thd->restore_active_arena(arena, &backup);
DBUG_RETURN(FALSE);
}
@@ -1030,13 +1040,6 @@ bool mysql_make_view(THD *thd, File_pars
/*TODO: md5 test here and warning if it is differ */
- /*
- Initialize view definition context by character set names loaded from
- the view definition file. Use UTF8 character set if view definition
- file is of old version and does not contain the character set names.
- */
-
- table->view_creation_ctx= View_creation_ctx::create(thd, table);
/*
TODO: TABLE mem root should be used here when VIEW will be stored in
diff -Nrup a/sql/unireg.h b/sql/unireg.h
--- a/sql/unireg.h 2007-09-11 22:44:04 +05:00
+++ b/sql/unireg.h 2007-11-06 15:53:25 +04:00
@@ -189,6 +189,11 @@
*/
#define OPTIMIZE_I_S_TABLE OPEN_VIEW_FULL*2
+/*
+ The flag means that we need to process trigger files only.
+*/
+#define OPEN_TRIGGER_ONLY OPTIMIZE_I_S_TABLE*2
+
#define SC_INFO_LENGTH 4 /* Form format constant */
#define TE_INFO_LENGTH 3
#define MTYP_NOEMPTY_BIT 128
Thread |
---|
• bk commit into 6.0 tree (gluh:1.2666) WL#3732 | gluh | 6 Nov |