diff --git a/sqlx-core/src/postgres/connection/mod.rs b/sqlx-core/src/postgres/connection/mod.rs index ea49a532cf..32af0ae9de 100644 --- a/sqlx-core/src/postgres/connection/mod.rs +++ b/sqlx-core/src/postgres/connection/mod.rs @@ -178,18 +178,18 @@ impl Connection for PgConnection { } } -pub trait PgConnectionInfo { +pub trait ConnectionExt { /// the version number of the server in `libpq` format fn server_version_num(&self) -> Option; } -impl PgConnectionInfo for PgConnection { +impl ConnectionExt for PgConnection { fn server_version_num(&self) -> Option { self.stream.server_version_num } } -impl PgConnectionInfo for crate::pool::PoolConnection { +impl ConnectionExt for crate::pool::PoolConnection { fn server_version_num(&self) -> Option { self.stream.server_version_num } diff --git a/sqlx-core/src/postgres/mod.rs b/sqlx-core/src/postgres/mod.rs index ed6af06a33..bb5fa3e721 100644 --- a/sqlx-core/src/postgres/mod.rs +++ b/sqlx-core/src/postgres/mod.rs @@ -22,7 +22,7 @@ mod migrate; pub use arguments::{PgArgumentBuffer, PgArguments}; pub use column::PgColumn; -pub use connection::{PgConnection, PgConnectionInfo}; +pub use connection::{ConnectionExt, PgConnection}; pub use database::Postgres; pub use error::{PgDatabaseError, PgErrorPosition}; pub use listener::{PgListener, PgNotification}; diff --git a/tests/postgres/postgres.rs b/tests/postgres/postgres.rs index a88c0085e7..401c2f5aa7 100644 --- a/tests/postgres/postgres.rs +++ b/tests/postgres/postgres.rs @@ -2,7 +2,7 @@ use futures::TryStreamExt; use sqlx::postgres::{ PgConnectOptions, PgConnection, PgDatabaseError, PgErrorPosition, PgSeverity, }; -use sqlx::postgres::{PgConnectionInfo, PgPoolOptions, PgRow, Postgres}; +use sqlx::postgres::{PgPoolOptions, PgRow, Postgres}; use sqlx::{Column, Connection, Executor, Row, Statement, TypeInfo}; use sqlx_test::{new, setup_if_needed}; use std::env; @@ -968,6 +968,8 @@ async fn test_listener_cleanup() -> anyhow::Result<()> { #[sqlx_macros::test] async fn it_supports_domain_types_in_composite_domain_types() -> anyhow::Result<()> { + use sqlx::postgres::ConnectionExt; + // Only supported in Postgres 11+ let mut conn = new::().await?; if matches!(conn.server_version_num(), Some(version) if version < 110000) { @@ -1096,7 +1098,7 @@ CREATE TABLE heating_bills ( #[sqlx_macros::test] async fn test_pg_server_num() -> anyhow::Result<()> { - use sqlx::postgres::PgConnectionInfo; + use sqlx::postgres::ConnectionExt; let conn = new::().await?;