diff --git a/sqlx-core/src/postgres/types/mod.rs b/sqlx-core/src/postgres/types/mod.rs index faabbe153..28404d8b2 100644 --- a/sqlx-core/src/postgres/types/mod.rs +++ b/sqlx-core/src/postgres/types/mod.rs @@ -24,6 +24,14 @@ impl PgTypeInfo { pub(crate) fn new(id: TypeId) -> Self { Self { id } } + + /// Create a `PgTypeInfo` from a type's object identifier. + /// + /// The object identifier of a type can be queried with + /// `SELECT oid FROM pg_type WHERE typname = ;` + pub fn with_oid(oid: u32) -> Self { + Self { id: TypeId(oid) } + } } impl Display for PgTypeInfo {