Merge pull request #7562 from amosbird/parser3

Complement to #7501
This commit is contained in:
alexey-milovidov 2019-11-01 13:15:36 +03:00 committed by GitHub
commit b1fe128109
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -188,6 +188,13 @@ void DataTypeTuple::deserializeText(IColumn & column, ReadBuffer & istr, const F
}
});
// Special format for one element tuple (1,)
if (1 == elems.size())
{
skipWhitespaceIfAny(istr);
// Allow both (1) and (1,)
checkChar(',', istr);
}
skipWhitespaceIfAny(istr);
assertChar(')', istr);
}

View File

@ -2,4 +2,12 @@ SELECT toTypeName((1,)), (1,);
SET enable_debug_queries = 1;
ANALYZE SELECT (1,)
ANALYZE SELECT (1,);
DROP TABLE IF EXISTS tuple_values;
CREATE TABLE tuple_values (t Tuple(int)) ENGINE = Memory;
INSERT INTO tuple_values VALUES ((1)), ((2,));
DROP TABLE tuple_values;