Fix subquery with untuple.

This commit is contained in:
Nikolai Kochetov 2021-04-12 15:15:55 +03:00
parent 30f2d839c3
commit 0448e1415f
3 changed files with 9 additions and 6 deletions

View File

@ -293,13 +293,11 @@ void removeUnneededColumnsFromSelectClause(const ASTSelectQuery * select_query,
else
{
ASTFunction * func = elem->as<ASTFunction>();
/// Never remove untuple. It's result column may be in required columns.
/// It is not easy to analyze untuple here, because types were not calculated yes.
if (func && func->name == "untuple")
for (const auto & col : required_result_columns)
if (col.rfind("_ut_", 0) == 0)
{
new_elements.push_back(elem);
break;
}
}
}

View File

@ -0,0 +1,2 @@
(0.5,'92233720368547758.07',NULL) 1.00 256 \N \N
\N

View File

@ -0,0 +1,3 @@
SELECT (0.5, '92233720368547758.07', NULL), '', '1.00', untuple(('256', NULL)), NULL FROM (SELECT untuple(((NULL, untuple((('0.0000000100', (65536, NULL, (65535, 9223372036854775807), '25.7', (0.00009999999747378752, '10.25', 1048577), 65536)), '0.0000001024', '65537', NULL))), untuple((9223372036854775807, -inf, 0.5)), NULL, -9223372036854775808)), 257, 7, ('0.0001048575', (1024, NULL, (7, 3), (untuple(tuple(-NULL)), NULL, '0.0001048577', NULL), 0)), 0, (0, 0.9998999834060669, '65537'), untuple(tuple('10.25')));
SELECT NULL FROM (SELECT untuple((NULL, dummy)));