Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit a75f55d

Browse files
committed
Add test case for type cast in expressions
1 parent c767b4e commit a75f55d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/parser/postgresparser_test.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,5 +1220,25 @@ TEST_F(PostgresParserTests, TypeCastTest) {
12201220
}
12211221
}
12221222

1223+
TEST_F(PostgresParserTests, TypeCastInExpressionTest) {
1224+
std::vector<std::string> queries;
1225+
queries.push_back("SELECT * FROM a WHERE d <= date '2018-04-04';");
1226+
queries.push_back("SELECT '12345'::INTEGER - 12");
1227+
// Parsing
1228+
UNUSED_ATTRIBUTE int ii = 0;
1229+
for (auto query : queries) {
1230+
std::unique_ptr<parser::SQLStatementList> result(
1231+
parser::PostgresParser::ParseSQLString(query.c_str()));
1232+
1233+
if (result->is_valid == false) {
1234+
LOG_ERROR("Message: %s, line: %d, col: %d", result->parser_msg,
1235+
result->error_line, result->error_col);
1236+
}
1237+
EXPECT_EQ(result->is_valid, true);
1238+
1239+
LOG_TRACE("%d : %s", ++ii, result->GetInfo().c_str());
1240+
}
1241+
}
1242+
12231243
} // namespace test
12241244
} // namespace peloton

0 commit comments

Comments
 (0)