Skip to content

Commit d6ee93f

Browse files
committed
Fix:A bunch of tiny improvements here and there
1 parent 4e4744a commit d6ee93f

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/pgwire_integration.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ impl pgwire::api::query::SimpleQueryHandler for DfSessionService {
244244
})?;
245245
vec![Response::Query(qr)]
246246
};
247-
// Do not manually send ReadyForQuery here; the PGWire framework handles it.
247+
// Let PGWire automatically send ReadyForQuery.
248248
Ok(responses)
249249
}
250250
}
@@ -322,7 +322,7 @@ impl pgwire::api::query::ExtendedQueryHandler for DfSessionService {
322322
let resp = encode_dataframe(df, &portal.result_column_format)
323323
.await
324324
.map_err(|e| PgWireError::ApiError(e.into()))?;
325-
// Do not manually send ReadyForQuery here.
325+
// Let PGWire automatically send ReadyForQuery.
326326
Ok(Response::Query(resp))
327327
}
328328
}
@@ -457,7 +457,14 @@ impl pgwire::api::auth::StartupHandler for DfSessionService {
457457
error!("Failed to send AuthenticationOk: {:?}", e);
458458
PgWireError::IoError(std::io::Error::new(ErrorKind::Other, format!("{:?}", e)))
459459
})?;
460-
// ReadyForQuery is already sent by the framework after startup.
460+
client.send(PgWireBackendMessage::ReadyForQuery(
461+
ReadyForQuery::new(TransactionStatus::Idle)
462+
))
463+
.await
464+
.map_err(|e| {
465+
error!("Failed to send ReadyForQuery: {:?}", e);
466+
PgWireError::IoError(std::io::Error::new(ErrorKind::Other, format!("{:?}", e)))
467+
})?;
461468
debug!("Startup completed successfully for user '{}'", user);
462469
return Ok(());
463470
} else {
@@ -476,6 +483,14 @@ impl pgwire::api::auth::StartupHandler for DfSessionService {
476483
error!("Failed to send AuthenticationOk: {:?}", e);
477484
PgWireError::IoError(std::io::Error::new(ErrorKind::Other, format!("{:?}", e)))
478485
})?;
486+
client.send(PgWireBackendMessage::ReadyForQuery(
487+
ReadyForQuery::new(TransactionStatus::Idle)
488+
))
489+
.await
490+
.map_err(|e| {
491+
error!("Failed to send ReadyForQuery: {:?}", e);
492+
PgWireError::IoError(std::io::Error::new(ErrorKind::Other, format!("{:?}", e)))
493+
})?;
479494
debug!("Startup completed successfully with fallback for user '{}'", user);
480495
return Ok(());
481496
} else {

0 commit comments

Comments
 (0)