diff options
author | Sergei Golubchik <serg@mariadb.org> | 2017-04-19 15:58:15 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2017-04-30 14:58:11 +0200 |
commit | 5ccaabe9620bcf9e960ae019d7e27e5998a772bd (patch) | |
tree | 6bc64bbc1d6b2cce1f37dbab8304da5f1694efe9 | |
parent | d17093b2edfbd1422f224c553eb73c9263eeeb1a (diff) | |
download | mariadb-git-5ccaabe9620bcf9e960ae019d7e27e5998a772bd.tar.gz |
MDEV-10355 Weird error message upon CREATE TABLE with DEFAULT
post-fix for 0b52b28b91
* restore EXPLAIN output
* remove redundant code
-rw-r--r-- | mysql-test/r/derived_cond_pushdown.result | 28 | ||||
-rw-r--r-- | mysql-test/r/explain_json.result | 6 | ||||
-rw-r--r-- | mysql-test/r/range.result | 18 | ||||
-rw-r--r-- | mysql-test/r/range_mrr_icp.result | 18 | ||||
-rw-r--r-- | sql/item.cc | 32 | ||||
-rw-r--r-- | sql/item.h | 9 |
6 files changed, 53 insertions, 58 deletions
diff --git a/mysql-test/r/derived_cond_pushdown.result b/mysql-test/r/derived_cond_pushdown.result index 308c11cb3a8..dbc25fb255c 100644 --- a/mysql-test/r/derived_cond_pushdown.result +++ b/mysql-test/r/derived_cond_pushdown.result @@ -7118,7 +7118,7 @@ EXPLAIN { "query_block": { "select_id": 1, - "const_condition": "2 < 2 or <in_optimizer>(2,<exists>(subquery#3))", + "const_condition": "0 or <in_optimizer>(2,<exists>(subquery#3))", "table": { "table_name": "t1", "access_type": "system", @@ -7202,7 +7202,7 @@ EXPLAIN { "query_block": { "select_id": 1, - "const_condition": "2 < 2 or <in_optimizer>(2,<exists>(subquery#3))", + "const_condition": "0 or <in_optimizer>(2,<exists>(subquery#3))", "table": { "table_name": "t1", "access_type": "system", @@ -7668,7 +7668,7 @@ EXPLAIN "access_type": "ALL", "rows": 2, "filtered": 100, - "attached_condition": "v1.b = count(t2.c)", + "attached_condition": "v1.b = 2", "materialized": { "query_block": { "select_id": 3, @@ -7725,7 +7725,7 @@ EXPLAIN "access_type": "ALL", "rows": 2, "filtered": 100, - "attached_condition": "v1.f = count(t.pk)", + "attached_condition": "v1.f = 2", "materialized": { "query_block": { "select_id": 3, @@ -7745,7 +7745,7 @@ EXPLAIN "access_type": "ALL", "rows": 2, "filtered": 100, - "attached_condition": "v2.pk > count(t.pk)" + "attached_condition": "v2.pk > 2" }, "buffer_type": "flat", "buffer_size": "256Kb", @@ -7804,7 +7804,7 @@ EXPLAIN "access_type": "ALL", "rows": 3, "filtered": 100, - "attached_condition": "sq.i = min(t2.j)", + "attached_condition": "sq.i = 3", "materialized": { "query_block": { "select_id": 2, @@ -7861,7 +7861,7 @@ EXPLAIN "access_type": "ALL", "rows": 3, "filtered": 100, - "attached_condition": "sq.i = min(t2.j)", + "attached_condition": "sq.i = 2.7100000381469727", "materialized": { "query_block": { "select_id": 2, @@ -7913,7 +7913,7 @@ EXPLAIN "access_type": "ALL", "rows": 3, "filtered": 100, - "attached_condition": "sq.i = min(t2.j)", + "attached_condition": "sq.i = 3.21", "materialized": { "query_block": { "select_id": 2, @@ -7965,7 +7965,7 @@ EXPLAIN "access_type": "ALL", "rows": 3, "filtered": 100, - "attached_condition": "sq.i = min(t2.j)", + "attached_condition": "sq.i = 'aa'", "materialized": { "query_block": { "select_id": 2, @@ -8019,7 +8019,7 @@ EXPLAIN "access_type": "ALL", "rows": 3, "filtered": 100, - "attached_condition": "sq.i = min(t2.j)", + "attached_condition": "sq.i = '2007-05-28 00:00:00'", "materialized": { "query_block": { "select_id": 2, @@ -8071,7 +8071,7 @@ EXPLAIN "access_type": "ALL", "rows": 3, "filtered": 100, - "attached_condition": "sq.i = min(t2.j)", + "attached_condition": "sq.i = '2007-05-28'", "materialized": { "query_block": { "select_id": 2, @@ -8123,7 +8123,7 @@ EXPLAIN "access_type": "ALL", "rows": 3, "filtered": 100, - "attached_condition": "sq.i = min(t2.j)", + "attached_condition": "sq.i = '10:00:02'", "materialized": { "query_block": { "select_id": 2, @@ -8214,7 +8214,7 @@ EXPLAIN "access_type": "ALL", "rows": 2, "filtered": 100, - "attached_condition": "v1.c = min(t2.c)", + "attached_condition": "v1.c = NULL", "materialized": { "query_block": { "select_id": 3, @@ -8317,7 +8317,7 @@ EXPLAIN "access_type": "ALL", "rows": 2, "filtered": 100, - "attached_condition": "<in_optimizer>(1,<exists>(subquery#2)) or v1.c = 'foo'", + "attached_condition": "<cache>(<in_optimizer>(1,<exists>(subquery#2))) or v1.c = 'foo'", "materialized": { "query_block": { "select_id": 3, diff --git a/mysql-test/r/explain_json.result b/mysql-test/r/explain_json.result index f416e5c2554..1af67cf6a4e 100644 --- a/mysql-test/r/explain_json.result +++ b/mysql-test/r/explain_json.result @@ -811,7 +811,7 @@ EXPLAIN "ref": ["func"], "rows": 2, "filtered": 100, - "attached_condition": "trigcond(outer_t1.a = t1.a or t1.a is null)", + "attached_condition": "trigcond(<cache>(outer_t1.a) = t1.a or t1.a is null)", "using_index": true } }, @@ -825,7 +825,7 @@ EXPLAIN "buffer_type": "flat", "buffer_size": "256Kb", "join_type": "BNL", - "attached_condition": "t2.b <> outer_t1.a and trigcond(outer_t1.a = t1.a or t1.a is null)" + "attached_condition": "t2.b <> outer_t1.a and trigcond(<cache>(outer_t1.a) = t1.a or t1.a is null)" } } } @@ -1106,7 +1106,7 @@ EXPLAIN "access_type": "ALL", "rows": 2, "filtered": 100, - "attached_condition": "(case when convert(t1.a using utf8) = _utf8'a' collate utf8_bin then NULL else t1.a end)" + "attached_condition": "(case when convert(t1.a using utf8) = <cache>(_utf8'a' collate utf8_bin) then NULL else t1.a end)" } } } diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index 3c57ab980c3..28f5cf635d0 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -2371,7 +2371,7 @@ EXPLAIN "used_key_parts": ["a", "b"], "rows": 7, "filtered": 100, - "attached_condition": "(t1.a,t1.b) in ((2,3),(3,3),(8,8),(7,7))" + "attached_condition": "(t1.a,t1.b) in (<cache>((2,3)),<cache>((3,3)),<cache>((8,8)),<cache>((7,7)))" } } } @@ -2431,7 +2431,7 @@ EXPLAIN "used_key_parts": ["a"], "rows": 5, "filtered": 100, - "attached_condition": "(t1.a,t1.b + t1.a) in ((4,9),(8,8),(7,7))" + "attached_condition": "(t1.a,t1.b + t1.a) in (<cache>((4,9)),<cache>((8,8)),<cache>((7,7)))" } } } @@ -2498,7 +2498,7 @@ EXPLAIN "rows": 3, "filtered": 100, "index_condition": "t2.d is not null", - "attached_condition": "(t2.d,t2.e) in ((3,3),(7,7),(2,2))" + "attached_condition": "(t2.d,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((2,2)))" }, "table": { "table_name": "t1", @@ -2581,7 +2581,7 @@ EXPLAIN "ref": ["test.t1.a"], "rows": 12, "filtered": 100, - "attached_condition": "(t1.a,t2.e) in ((3,3),(7,7),(8,8)) and length(t2.f) = 1" + "attached_condition": "(t1.a,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((8,8))) and length(t2.f) = 1" } } } @@ -2666,7 +2666,7 @@ EXPLAIN "used_key_parts": ["e"], "rows": 6, "filtered": 100, - "attached_condition": "(t2.d,t2.e) in ((4,4),(7,7),(8,8)) and length(t2.f) = 1 and t2.d is not null" + "attached_condition": "(t2.d,t2.e) in (<cache>((4,4)),<cache>((7,7)),<cache>((8,8))) and length(t2.f) = 1 and t2.d is not null" }, "table": { "table_name": "t1", @@ -2716,7 +2716,7 @@ EXPLAIN "rows": 5, "filtered": 100, "index_condition": "t2.d is not null", - "attached_condition": "(t2.d,t2.e) in ((4,4),(7,7),(8,8)) and length(t2.f) = 1" + "attached_condition": "(t2.d,t2.e) in (<cache>((4,4)),<cache>((7,7)),<cache>((8,8))) and length(t2.f) = 1" }, "table": { "table_name": "t1", @@ -2830,7 +2830,7 @@ EXPLAIN "ref": ["test.t1.a"], "rows": 3, "filtered": 100, - "attached_condition": "(t1.a,t2.e) in ((t2.e,t1.a + 1),(7,7),(8,8)) and length(t2.f) = 1" + "attached_condition": "(t1.a,t2.e) in ((t2.e,t1.a + 1),<cache>((7,7)),<cache>((8,8))) and length(t2.f) = 1" } } } @@ -2870,7 +2870,7 @@ EXPLAIN "rows": 13, "filtered": 100, "index_condition": "t1.a is not null", - "attached_condition": "(t1.a,2) in ((2,2),(7,7),(8,8)) and length(t1.c) = 1" + "attached_condition": "(t1.a,2) in (<cache>((2,2)),<cache>((7,7)),<cache>((8,8))) and length(t1.c) = 1" }, "table": { "table_name": "t2", @@ -2958,7 +2958,7 @@ EXPLAIN "rows": 13, "filtered": 100, "index_condition": "t1.a is not null", - "attached_condition": "(t1.a,1 + 1) in ((2,2),(7,7),(8,8)) and length(t1.c) = 1" + "attached_condition": "(t1.a,1 + 1) in (<cache>((2,2)),<cache>((7,7)),<cache>((8,8))) and length(t1.c) = 1" }, "table": { "table_name": "t2", diff --git a/mysql-test/r/range_mrr_icp.result b/mysql-test/r/range_mrr_icp.result index 445f0877586..f2860aaab76 100644 --- a/mysql-test/r/range_mrr_icp.result +++ b/mysql-test/r/range_mrr_icp.result @@ -2373,7 +2373,7 @@ EXPLAIN "used_key_parts": ["a", "b"], "rows": 7, "filtered": 100, - "attached_condition": "(t1.a,t1.b) in ((2,3),(3,3),(8,8),(7,7))", + "attached_condition": "(t1.a,t1.b) in (<cache>((2,3)),<cache>((3,3)),<cache>((8,8)),<cache>((7,7)))", "mrr_type": "Rowid-ordered scan" } } @@ -2434,7 +2434,7 @@ EXPLAIN "used_key_parts": ["a"], "rows": 5, "filtered": 100, - "attached_condition": "(t1.a,t1.b + t1.a) in ((4,9),(8,8),(7,7))", + "attached_condition": "(t1.a,t1.b + t1.a) in (<cache>((4,9)),<cache>((8,8)),<cache>((7,7)))", "mrr_type": "Rowid-ordered scan" } } @@ -2503,7 +2503,7 @@ EXPLAIN "rows": 3, "filtered": 100, "index_condition": "t2.d is not null", - "attached_condition": "(t2.d,t2.e) in ((3,3),(7,7),(2,2))", + "attached_condition": "(t2.d,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((2,2)))", "mrr_type": "Rowid-ordered scan" }, "table": { @@ -2588,7 +2588,7 @@ EXPLAIN "ref": ["test.t1.a"], "rows": 12, "filtered": 100, - "attached_condition": "(t1.a,t2.e) in ((3,3),(7,7),(8,8)) and length(t2.f) = 1" + "attached_condition": "(t1.a,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((8,8))) and length(t2.f) = 1" } } } @@ -2673,7 +2673,7 @@ EXPLAIN "used_key_parts": ["e"], "rows": 6, "filtered": 100, - "attached_condition": "(t2.d,t2.e) in ((4,4),(7,7),(8,8)) and length(t2.f) = 1 and t2.d is not null", + "attached_condition": "(t2.d,t2.e) in (<cache>((4,4)),<cache>((7,7)),<cache>((8,8))) and length(t2.f) = 1 and t2.d is not null", "mrr_type": "Rowid-ordered scan" }, "table": { @@ -2724,7 +2724,7 @@ EXPLAIN "rows": 5, "filtered": 100, "index_condition": "t2.d is not null", - "attached_condition": "(t2.d,t2.e) in ((4,4),(7,7),(8,8)) and length(t2.f) = 1", + "attached_condition": "(t2.d,t2.e) in (<cache>((4,4)),<cache>((7,7)),<cache>((8,8))) and length(t2.f) = 1", "mrr_type": "Rowid-ordered scan" }, "table": { @@ -2840,7 +2840,7 @@ EXPLAIN "ref": ["test.t1.a"], "rows": 3, "filtered": 100, - "attached_condition": "(t1.a,t2.e) in ((t2.e,t1.a + 1),(7,7),(8,8)) and length(t2.f) = 1" + "attached_condition": "(t1.a,t2.e) in ((t2.e,t1.a + 1),<cache>((7,7)),<cache>((8,8))) and length(t2.f) = 1" } } } @@ -2880,7 +2880,7 @@ EXPLAIN "rows": 13, "filtered": 100, "index_condition": "t1.a is not null", - "attached_condition": "(t1.a,2) in ((2,2),(7,7),(8,8)) and length(t1.c) = 1", + "attached_condition": "(t1.a,2) in (<cache>((2,2)),<cache>((7,7)),<cache>((8,8))) and length(t1.c) = 1", "mrr_type": "Rowid-ordered scan" }, "table": { @@ -2969,7 +2969,7 @@ EXPLAIN "rows": 13, "filtered": 100, "index_condition": "t1.a is not null", - "attached_condition": "(t1.a,1 + 1) in ((2,2),(7,7),(8,8)) and length(t1.c) = 1", + "attached_condition": "(t1.a,1 + 1) in (<cache>((2,2)),<cache>((7,7)),<cache>((8,8))) and length(t1.c) = 1", "mrr_type": "Rowid-ordered scan" }, "table": { diff --git a/sql/item.cc b/sql/item.cc index 5d6c4bb67a6..579b6539fb4 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -9418,27 +9418,24 @@ void Item_cache::store(Item *item) void Item_cache::print(String *str, enum_query_type query_type) { if (example && // There is a cached item - (query_type & QT_ITEM_CACHE_WRAPPER_SKIP_DETAILS)) // Caller is show-create-table + (query_type & QT_NO_DATA_EXPANSION)) // Caller is show-create-table { // Instead of "cache" or the cached value, print the cached item name example->print(str, query_type); + return; } - else + + if (value_cached) { - if (value_cached && !(query_type & QT_NO_DATA_EXPANSION)) - { - print_value(str); - return; - } - if (!(query_type & QT_ITEM_CACHE_WRAPPER_SKIP_DETAILS)) - str->append(STRING_WITH_LEN("<cache>(")); - if (example) - example->print(str, query_type); - else - Item::print(str, query_type); - if (!(query_type & QT_ITEM_CACHE_WRAPPER_SKIP_DETAILS)) - str->append(')'); + print_value(str); + return; } + str->append(STRING_WITH_LEN("<cache>(")); + if (example) + example->print(str, query_type); + else + Item::print(str, query_type); + str->append(')'); } /** @@ -10669,8 +10666,7 @@ void Virtual_column_info::print(String *str) (enum_query_type)(QT_ITEM_ORIGINAL_FUNC_NULLIF | QT_ITEM_IDENT_SKIP_DB_NAMES | QT_ITEM_IDENT_SKIP_TABLE_NAMES | - QT_ITEM_CACHE_WRAPPER_SKIP_DETAILS | - QT_TO_SYSTEM_CHARSET | - QT_NO_DATA_EXPANSION), + QT_NO_DATA_EXPANSION | + QT_TO_SYSTEM_CHARSET), LOWEST_PRECEDENCE); } diff --git a/sql/item.h b/sql/item.h index a0137144140..42e9fd94331 100644 --- a/sql/item.h +++ b/sql/item.h @@ -5475,17 +5475,16 @@ public: { Item::vcol_func_processor_result *res= (Item::vcol_func_processor_result*)arg; example->check_vcol_func_processor(arg); + /* + Item_cache of a non-deterministic function requires re-fixing + even if the function itself doesn't (e.g. CURRENT_TIMESTAMP) + */ if (res->errors & VCOL_NOT_STRICTLY_DETERMINISTIC) res->errors|= VCOL_SESSION_FUNC; return false; } return mark_unsupported_function("cache", arg, VCOL_IMPOSSIBLE); } - bool cleanup_excluding_fields_processor(void* arg) - { - cleanup(); - return 0; - } void cleanup() { clear(); |