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:
Jesse Wang
2024-03-15 08:05:44 +13:00
committed by GitHub
parent 4c6830210b
commit 936744dfd6
3 changed files with 18 additions and 13 deletions

View File

@@ -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"] }

View File

@@ -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)