Patch approved. Looking forward to see a test case with no table alias :-)
On 12/03/2010 04:26 PM, Guilhem Bichot wrote:
> #At file:///home/mysql_src/bzrrepos_new/mysql-next-mr-opt-backporting-wl4800/ based
> on revid:guilhem@stripped
>
> 3239 Guilhem Bichot 2010-12-03
> review comments. Fix for a bug with views (testcase will come later,
> part of bigger unfinished work).
>
> modified:
> sql/opt_trace.h
> sql/sql_view.cc
> === modified file 'sql/opt_trace.h'
> --- a/sql/opt_trace.h 2010-11-26 16:16:31 +0000
> +++ b/sql/opt_trace.h 2010-12-03 15:26:41 +0000
> @@ -389,7 +389,7 @@ public:
> This feature cannot be disabled by the user; for this it is important
> that it always has biggest flag; flag's value itself does not matter
> */
> - MISC= 4
> + MISC= 128
> };
> static const feature_value FEATURES_DEFAULT;
>
> @@ -1163,7 +1163,7 @@ public:
> Opt_trace_struct(ctx, false, key, feature) {}
> /**
> Constructs an array. No key is specified, so the array is just a value
> - (servesfor adding the object to an array).
> + (serves for adding the object to an array).
> @param ctx context for this array
> */
> Opt_trace_array(Opt_trace_context *ctx,
> @@ -1360,7 +1360,7 @@ public:
> enum feature_value {
> GREEDY_SEARCH= 1,
> RANGE_OPTIMIZER= 2,
> - MISC= 4
> + MISC= 128
> };
> };
>
>
> === modified file 'sql/sql_view.cc'
> --- a/sql/sql_view.cc 2010-11-24 18:54:26 +0000
> +++ b/sql/sql_view.cc 2010-12-03 15:26:41 +0000
> @@ -1141,8 +1141,9 @@ bool mysql_make_view(THD *thd, File_pars
>
> Opt_trace_object trace_wrapper(thd->opt_trace);
> Opt_trace_object trace_view(thd->opt_trace, "view");
> + // When reading I_S.VIEWS, table->alias may be NULL
> trace_view.add_utf8("database", table->db, table->db_length).
> - add_utf8("view", table->alias).
> + add_utf8("view", table->alias ? table->alias : table->table_name).
> add("in_select#", old_lex->select_lex.select_number);
>
> /*
>
>
>
>
>
--
Jørgen Løland | Senior Software Engineer | +47 73842138
Oracle MySQL
Trondheim, Norway