Disable table function view in expression (#21465)

This commit is contained in:
Amos Bird 2021-04-06 21:08:29 +08:00 committed by GitHub
parent 3708821689
commit a89e3df40a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -15,8 +15,16 @@
namespace DB
{
namespace ErrorCodes
{
extern const int UNEXPECTED_EXPRESSION;
}
void ASTFunction::appendColumnNameImpl(WriteBuffer & ostr) const
{
if (name == "view")
throw Exception("Table function view cannot be used as an expression", ErrorCodes::UNEXPECTED_EXPRESSION);
writeString(name, ostr);
if (parameters)

View File

@ -1 +1,3 @@
SELECT view(SELECT 1); -- { clientError 62 }
SELECT sumIf(dummy, dummy) FROM remote('127.0.0.{1,2}', numbers(2, 100), view(SELECT CAST(NULL, 'Nullable(UInt8)') AS dummy FROM system.one)); -- { serverError 183 }