Skip to content
Snippets Groups Projects
Unverified Commit aea51a5c authored by Shylock Hg's avatar Shylock Hg Committed by GitHub
Browse files

Don't allow label as expression. It's not a value. (#116)


* Don't allow label as expression. It's not a value.

* Add the name label with ``.

Co-authored-by: default avatardutor <440396+dutor@users.noreply.github.com>
parent 2010681a
No related branches found
No related tags found
No related merge requests found
......@@ -359,10 +359,6 @@ base_expression
| BOOL {
$$ = new ConstantExpression($1);
}
| name_label {
$$ = new ConstantExpression(*$1);
delete $1;
}
| KW_NULL {
$$ = new ConstantExpression(NullType::__NULL__);
}
......
......@@ -1624,7 +1624,7 @@ TEST(Parser, ConfigOperation) {
}
{
GQLParser parser;
std::string query = "UPDATE CONFIGS storage:name=value";
std::string query = "UPDATE CONFIGS storage:name=\"value\"";
auto result = parser.parse(query);
ASSERT_TRUE(result.ok()) << result.status();
}
......@@ -2020,4 +2020,21 @@ TEST(Parser, UseReservedKeyword) {
ASSERT_TRUE(result.ok());
}
}
TEST(Parser, IssueLabelAsExpression) {
// name label is not a valid expression, it's not value
{
GQLParser parser;
std::string query = "INSERT VERTEX person(name) VALUES \"1\":(name_label)";
auto result = parser.parse(query);
ASSERT_FALSE(result.ok());
}
{
GQLParser parser;
std::string query = "INSERT VERTEX person(name) VALUES \"1\":(`name_label`)";
auto result = parser.parse(query);
ASSERT_FALSE(result.ok());
}
}
} // namespace nebula
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