Skip to content

Commit a07d33c

Browse files
committed
inline the first explain using smallvec
1 parent 1800fff commit a07d33c

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

Cargo.lock

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sqlx-postgres/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ log = "0.4.17"
5858
memchr = { version = "2.4.1", default-features = false }
5959
num-bigint = { version = "0.4.3", optional = true }
6060
once_cell = "1.9.0"
61-
smallvec = "1.7.0"
61+
smallvec = { version = "1.7.0", features = ["serde"] }
6262
stringprep = "0.1.2"
6363
thiserror = "1.0.35"
6464
tracing = { version = "0.1.37", features = ["log"] }

sqlx-postgres/src/connection/describe.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use crate::types::Oid;
1010
use crate::HashMap;
1111
use crate::{PgArguments, PgColumn, PgConnection, PgTypeInfo};
1212
use futures_core::future::BoxFuture;
13+
use smallvec::SmallVec;
1314
use std::fmt::Write;
1415
use std::sync::Arc;
1516

@@ -447,7 +448,8 @@ WHERE rngtypid = $1
447448
explain += ")";
448449
}
449450

450-
let (Json(explains),): (Json<Vec<Explain>>,) = query_as(&explain).fetch_one(self).await?;
451+
let (Json(explains),): (Json<SmallVec<[Explain; 1]>>,) =
452+
query_as(&explain).fetch_one(self).await?;
451453

452454
let mut nullables = Vec::new();
453455

@@ -460,7 +462,7 @@ WHERE rngtypid = $1
460462
}) = explains.first()
461463
{
462464
nullables.resize(outputs.len(), None);
463-
visit_plan(plan, outputs, &mut nullables);
465+
visit_plan(&plan, outputs, &mut nullables);
464466
}
465467

466468
Ok(nullables)

0 commit comments

Comments
 (0)