From 1800fffd5143e05bc36ba940d02baca6a5fd8814 Mon Sep 17 00:00:00 2001 From: Jesse Wang Date: Wed, 6 Sep 2023 11:46:24 +0000 Subject: [PATCH 1/3] fix postgres describe on multiple explains --- sqlx-postgres/src/connection/describe.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sqlx-postgres/src/connection/describe.rs b/sqlx-postgres/src/connection/describe.rs index 1cd28a8b54..8a5d1a23db 100644 --- a/sqlx-postgres/src/connection/describe.rs +++ b/sqlx-postgres/src/connection/describe.rs @@ -447,17 +447,17 @@ WHERE rngtypid = $1 explain += ")"; } - let (Json([explain]),): (Json<[Explain; 1]>,) = query_as(&explain).fetch_one(self).await?; + let (Json(explains),): (Json>,) = 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); From a07d33cdc68b3acfd8aefc837521c784102fda9b Mon Sep 17 00:00:00 2001 From: Jesse Wang Date: Wed, 6 Sep 2023 11:51:18 +0000 Subject: [PATCH 2/3] inline the first explain using smallvec --- Cargo.lock | 3 +++ sqlx-postgres/Cargo.toml | 2 +- sqlx-postgres/src/connection/describe.rs | 6 ++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 84f95476bc..e7753207d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3147,6 +3147,9 @@ name = "smallvec" version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +dependencies = [ + "serde", +] [[package]] name = "socket2" diff --git a/sqlx-postgres/Cargo.toml b/sqlx-postgres/Cargo.toml index 34ad38e13a..c9959196c7 100644 --- a/sqlx-postgres/Cargo.toml +++ b/sqlx-postgres/Cargo.toml @@ -58,7 +58,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"] } diff --git a/sqlx-postgres/src/connection/describe.rs b/sqlx-postgres/src/connection/describe.rs index 8a5d1a23db..189ae3389b 100644 --- a/sqlx-postgres/src/connection/describe.rs +++ b/sqlx-postgres/src/connection/describe.rs @@ -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,7 +448,8 @@ WHERE rngtypid = $1 explain += ")"; } - let (Json(explains),): (Json>,) = query_as(&explain).fetch_one(self).await?; + let (Json(explains),): (Json>,) = + query_as(&explain).fetch_one(self).await?; let mut nullables = Vec::new(); @@ -460,7 +462,7 @@ WHERE rngtypid = $1 }) = explains.first() { nullables.resize(outputs.len(), None); - visit_plan(plan, outputs, &mut nullables); + visit_plan(&plan, outputs, &mut nullables); } Ok(nullables) From f17b04b28178462cc223ca098f1ef89d8682df7d Mon Sep 17 00:00:00 2001 From: Austin Bonander Date: Mon, 11 Mar 2024 23:50:12 -0700 Subject: [PATCH 3/3] fix: regenerate `Cargo.lock` --- Cargo.lock | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c5178d74b9..b9575d6c12 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -136,9 +136,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.80" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1" +checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" [[package]] name = "argon2" @@ -479,9 +479,9 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "basic-toml" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2db21524cad41c5591204d22d75e1970a2d1f71060214ca931dc7d5afe2c14e5" +checksum = "823388e228f614e9558c6804262db37960ec8821856535f5c3f59913140558f8" dependencies = [ "serde", ] @@ -2520,9 +2520,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" dependencies = [ "unicode-ident", ] @@ -3095,12 +3095,11 @@ dependencies = [ name = "smallvec" version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" dependencies = [ "serde", ] - [[package]] name = "socket2" version = "0.4.10" @@ -3159,7 +3158,7 @@ dependencies = [ [[package]] name = "sqlx" -version = "0.7.4" +version = "0.8.0-alpha.0" dependencies = [ "anyhow", "async-std", @@ -3189,7 +3188,7 @@ dependencies = [ [[package]] name = "sqlx-cli" -version = "0.7.4" +version = "0.8.0-alpha.0" dependencies = [ "anyhow", "assert_cmd", @@ -3215,7 +3214,7 @@ dependencies = [ [[package]] name = "sqlx-core" -version = "0.7.4" +version = "0.8.0-alpha.0" dependencies = [ "ahash 0.8.11", "async-io 1.13.0", @@ -3399,7 +3398,7 @@ dependencies = [ [[package]] name = "sqlx-macros" -version = "0.7.4" +version = "0.8.0-alpha.0" dependencies = [ "proc-macro2", "quote", @@ -3410,7 +3409,7 @@ dependencies = [ [[package]] name = "sqlx-macros-core" -version = "0.7.4" +version = "0.8.0-alpha.0" dependencies = [ "async-std", "dotenvy", @@ -3435,7 +3434,7 @@ dependencies = [ [[package]] name = "sqlx-mysql" -version = "0.7.4" +version = "0.8.0-alpha.0" dependencies = [ "atoi", "base64 0.21.7", @@ -3480,7 +3479,7 @@ dependencies = [ [[package]] name = "sqlx-postgres" -version = "0.7.4" +version = "0.8.0-alpha.0" dependencies = [ "atoi", "base64 0.21.7", @@ -3525,7 +3524,7 @@ dependencies = [ [[package]] name = "sqlx-sqlite" -version = "0.7.4" +version = "0.8.0-alpha.0" dependencies = [ "atoi", "chrono", @@ -3710,18 +3709,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" +checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" +checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote",