fix: Update pgwire and fix buffer overflow issue (#293)

This commit is contained in:
Ning Sun
2022-09-29 17:58:03 +08:00
committed by GitHub
parent fe8327fc78
commit 178f8b64b5
3 changed files with 8 additions and 8 deletions

4
Cargo.lock generated
View File

@@ -3516,9 +3516,9 @@ dependencies = [
[[package]]
name = "pgwire"
version = "0.3.2"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41526874eeba2f8b06a3ed14510e29080b9fab15b86849fb3a7a733c9bc610b0"
checksum = "9e30e99a0b8acf60a6815aa8178e9ffb08178ef3ca1366673bb0d6c7ababe4c2"
dependencies = [
"async-trait",
"bytes",

View File

@@ -26,7 +26,7 @@ influxdb_line_protocol = { git = "https://github.com/evenyag/influxdb_iox", bran
metrics = "0.20"
num_cpus = "1.13"
opensrv-mysql = "0.1"
pgwire = { version = "0.3" }
pgwire = { version = "0.4" }
query = { path = "../query" }
serde = "1.0"
serde_json = "1.0"

View File

@@ -27,7 +27,7 @@ impl PostgresServerHandler {
#[async_trait]
impl SimpleQueryHandler for PostgresServerHandler {
async fn do_query<C>(&self, _client: &C, query: &str) -> PgWireResult<Response>
async fn do_query<C>(&self, _client: &C, query: &str) -> PgWireResult<Vec<Response>>
where
C: ClientInfo + Unpin + Send + Sync,
{
@@ -38,10 +38,10 @@ impl SimpleQueryHandler for PostgresServerHandler {
.map_err(|e| PgWireError::ApiError(Box::new(e)))?;
match output {
Output::AffectedRows(rows) => Ok(Response::Execution(Tag::new_for_execution(
Output::AffectedRows(rows) => Ok(vec![Response::Execution(Tag::new_for_execution(
"OK",
Some(rows),
))),
))]),
Output::Stream(record_stream) => {
let schema = record_stream.schema();
let recordbatches = util::collect(record_stream)
@@ -60,7 +60,7 @@ impl SimpleQueryHandler for PostgresServerHandler {
fn recordbatches_to_query_response<'a, I>(
recordbatches: I,
schema: SchemaRef,
) -> PgWireResult<Response>
) -> PgWireResult<Vec<Response>>
where
I: Iterator<Item = &'a RecordBatch>,
{
@@ -77,7 +77,7 @@ where
}
}
Ok(Response::Query(builder.build()))
Ok(vec![Response::Query(builder.build())])
}
fn schema_to_pg(origin: SchemaRef) -> Result<Vec<FieldInfo>> {