mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-23 10:38:57 +00:00
Fix describe on PostgreSQL views with rules (#2736)
* fix postgres describe on multiple explains * inline the first explain using smallvec * fix: regenerate `Cargo.lock` --------- Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
This commit is contained in:
@@ -57,7 +57,7 @@ log = "0.4.17"
|
||||
memchr = { version = "2.4.1", default-features = false }
|
||||
num-bigint = { version = "0.4.3", optional = true }
|
||||
once_cell = "1.9.0"
|
||||
smallvec = "1.7.0"
|
||||
smallvec = { version = "1.7.0", features = ["serde"] }
|
||||
stringprep = "0.1.2"
|
||||
thiserror = "1.0.35"
|
||||
tracing = { version = "0.1.37", features = ["log"] }
|
||||
|
||||
@@ -10,6 +10,7 @@ use crate::types::Oid;
|
||||
use crate::HashMap;
|
||||
use crate::{PgArguments, PgColumn, PgConnection, PgTypeInfo};
|
||||
use futures_core::future::BoxFuture;
|
||||
use smallvec::SmallVec;
|
||||
use std::fmt::Write;
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -447,20 +448,21 @@ WHERE rngtypid = $1
|
||||
explain += ")";
|
||||
}
|
||||
|
||||
let (Json([explain]),): (Json<[Explain; 1]>,) = query_as(&explain).fetch_one(self).await?;
|
||||
let (Json(explains),): (Json<SmallVec<[Explain; 1]>>,) =
|
||||
query_as(&explain).fetch_one(self).await?;
|
||||
|
||||
let mut nullables = Vec::new();
|
||||
|
||||
if let Explain::Plan {
|
||||
if let Some(Explain::Plan {
|
||||
plan:
|
||||
plan @ Plan {
|
||||
output: Some(ref outputs),
|
||||
..
|
||||
},
|
||||
} = &explain
|
||||
}) = explains.first()
|
||||
{
|
||||
nullables.resize(outputs.len(), None);
|
||||
visit_plan(plan, outputs, &mut nullables);
|
||||
visit_plan(&plan, outputs, &mut nullables);
|
||||
}
|
||||
|
||||
Ok(nullables)
|
||||
|
||||
Reference in New Issue
Block a user