mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-19 08:39:44 +00:00
Postgres OID resolution query does not take into account current search_path (#2133)
* Fix oid resolution query * Address review comments
This commit is contained in:
committed by
Austin Bonander
parent
9f1f682285
commit
ab2ae26189
@@ -344,17 +344,13 @@ WHERE rngtypid = $1
|
||||
}
|
||||
|
||||
// language=SQL
|
||||
let (oid,): (Oid,) = query_as(
|
||||
"
|
||||
SELECT oid FROM pg_catalog.pg_type WHERE typname ILIKE $1
|
||||
",
|
||||
)
|
||||
.bind(name)
|
||||
.fetch_optional(&mut *self)
|
||||
.await?
|
||||
.ok_or_else(|| Error::TypeNotFound {
|
||||
type_name: String::from(name),
|
||||
})?;
|
||||
let (oid,): (Oid,) = query_as("SELECT $1::regtype::oid")
|
||||
.bind(name)
|
||||
.fetch_optional(&mut *self)
|
||||
.await?
|
||||
.ok_or_else(|| Error::TypeNotFound {
|
||||
type_name: String::from(name),
|
||||
})?;
|
||||
|
||||
self.cache_type_oid.insert(name.to_string().into(), oid);
|
||||
Ok(oid)
|
||||
|
||||
@@ -176,6 +176,8 @@ impl Connection for PgConnection {
|
||||
|
||||
fn clear_cached_statements(&mut self) -> BoxFuture<'_, Result<(), Error>> {
|
||||
Box::pin(async move {
|
||||
self.cache_type_oid.clear();
|
||||
|
||||
let mut cleared = 0_usize;
|
||||
|
||||
self.wait_until_ready().await?;
|
||||
|
||||
Reference in New Issue
Block a user