Commit 5ccaabe9 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-10355 Weird error message upon CREATE TABLE with DEFAULT

post-fix for 0b52b28b

* restore EXPLAIN output
* remove redundant code
parent d17093b2
......@@ -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,
......
......@@ -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)"
}
}
}
......
......@@ -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",
......
......@@ -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": {
......
......@@ -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);
}
......@@ -5475,17 +5475,16 @@ class Item_cache: public Item_basic_constant,
{
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();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment