Skip to content

Commit

Permalink
Postgres: force generic plan when describing statement with args
Browse files Browse the repository at this point in the history
  • Loading branch information
joeydewaal committed Oct 5, 2024
1 parent 19f40d8 commit 59399b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions sqlx-postgres/src/connection/describe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::HashMap;
use crate::{PgColumn, PgConnection, PgTypeInfo};
use futures_core::future::BoxFuture;
use smallvec::SmallVec;
use sqlx_core::executor::Executor;
use sqlx_core::query_builder::QueryBuilder;
use std::sync::Arc;

Expand Down Expand Up @@ -523,6 +524,8 @@ WHERE rngtypid = $1
let mut comma = false;

if params_len > 0 {
self.execute("set plan_cache_mode = force_generic_plan;").await?;

explain += "(";

// fill the arguments list with NULL, which should theoretically be valid
Expand Down

0 comments on commit 59399b9

Please sign in to comment.