Skip to content

Commit

Permalink
Added missing special casing for encoding arrays of custom types
Browse files Browse the repository at this point in the history
  • Loading branch information
nico-incubiq committed Nov 19, 2024
1 parent 82d332f commit 747f22e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sqlx-postgres/src/types/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ impl<'a> PgRecordEncoder<'a> {
{
let ty = value.produces().unwrap_or_else(T::type_info);

if let PgType::DeclareWithName(name) = ty.0 {
match ty.0 {
// push a hole for this type ID
// to be filled in on query execution
self.buf.patch_type_by_name(&name);
} else {
PgType::DeclareWithName(name) => self.buf.patch_type_by_name(&name),
PgType::DeclareArrayOf(array) => self.buf.patch_array_type(array),
// write type id
self.buf.extend(&ty.0.oid().0.to_be_bytes());
pg_type => self.buf.extend(&pg_type.oid().0.to_be_bytes()),
}

self.buf.encode(value)?;
Expand Down

0 comments on commit 747f22e

Please sign in to comment.