Merge pull request #1028 from sfackler/int2vector
Fix int2vector serialization
This commit is contained in:
commit
23d2524f9b
@ -910,9 +910,9 @@ impl<'a, T: ToSql> ToSql for &'a [T] {
|
|||||||
_ => panic!("expected array type"),
|
_ => panic!("expected array type"),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Arrays are normally one indexed by default but oidvector *requires* zero indexing
|
// Arrays are normally one indexed by default but oidvector and int2vector *require* zero indexing
|
||||||
let lower_bound = match *ty {
|
let lower_bound = match *ty {
|
||||||
Type::OID_VECTOR => 0,
|
Type::OID_VECTOR | Type::INT2_VECTOR => 0,
|
||||||
_ => 1,
|
_ => 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -750,3 +750,14 @@ async fn oidvector() {
|
|||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn int2vector() {
|
||||||
|
test_type(
|
||||||
|
"int2vector",
|
||||||
|
// NB: postgres does not support empty int2vectors! All empty arrays are normalized to zero dimensions, but the
|
||||||
|
// oidvectorrecv function requires exactly one dimension.
|
||||||
|
&[(Some(vec![0i16, 1, 2]), "ARRAY[0,1,2]"), (None, "NULL")],
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user