@@ -425,15 +425,17 @@ void PostgresProtocolHandler::ExecParseMessage(InputPacket *pkt) {
425
425
return ;
426
426
}
427
427
428
- // If the query is either empty or redundant commands, or not supported yet,
428
+ // If the query is not supported yet,
429
429
// we will skip the rest commands (B,E,..) for this query
430
- bool skip = (sql_stmt_list.get () == nullptr ||
430
+ // For empty query, we still want to get it constructed
431
+ // TODO (Tianyi) Consider handle more statement
432
+ bool empty = (sql_stmt_list.get () == nullptr ||
431
433
sql_stmt_list->GetNumStatements () == 0 );
432
- if (!skip ) {
434
+ if (!empty ) {
433
435
parser::SQLStatement *sql_stmt = sql_stmt_list->GetStatement (0 );
434
436
query_type = StatementTypeToQueryType (sql_stmt->GetType (), sql_stmt);
435
437
}
436
- skip = skip || !HardcodedExecuteFilter (query_type);
438
+ bool skip = !HardcodedExecuteFilter (query_type);
437
439
if (skip) {
438
440
skipped_stmt_ = true ;
439
441
skipped_query_string_ = query;
@@ -539,6 +541,20 @@ void PostgresProtocolHandler::ExecBindMessage(InputPacket *pkt) {
539
541
LOG_ERROR (" %s" , error_message.c_str ());
540
542
SendErrorResponse (
541
543
{{NetworkMessageType::HUMAN_READABLE_ERROR, error_message}});
544
+ return ;
545
+ }
546
+
547
+ // Empty query
548
+ if (statement->GetQueryType () == QueryType::QUERY_INVALID) {
549
+ std::unique_ptr<OutputPacket> response (new OutputPacket ());
550
+ // Send Bind complete response
551
+ response->msg_type = NetworkMessageType::BIND_COMPLETE;
552
+ responses.push_back (std::move (response));
553
+ // TODO(Tianyi) This is a hack to respond correct describe message
554
+ // as well as execute message
555
+ skipped_stmt_ = true ;
556
+ skipped_query_string_ == " " ;
557
+ return ;
542
558
}
543
559
544
560
// UNNAMED STATEMENT
0 commit comments