diff --git a/test/tap/tests/reg_test_4402-mysql_fields-t.cpp b/test/tap/tests/reg_test_4402-mysql_fields-t.cpp index ff0d3e586..12dac63f5 100644 --- a/test/tap/tests/reg_test_4402-mysql_fields-t.cpp +++ b/test/tap/tests/reg_test_4402-mysql_fields-t.cpp @@ -106,7 +106,9 @@ int main(int argc, char** argv) { // to check table alias issue: { - const std::string& query = "SELECT data FROM testdb.dummy_table AS " + generate_random_string(length); + // NOTE: The randomly generated string should be escaped \`\`, otherwise could collide + // with SQL reserved words, causing an invalid test failure. + const std::string& query = "SELECT data FROM testdb.dummy_table AS `" + generate_random_string(length) + "`"; MYSQL_QUERY__(proxysql, query.c_str()); MYSQL_RES* res = mysql_use_result(proxysql);