Fix int2vector serialization
This commit is contained in:
parent
8449e4d9ea
commit
d92b3b0a63
@ -910,9 +910,9 @@ impl<'a, T: ToSql> ToSql for &'a [T] {
|
||||
_ => 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 {
|
||||
Type::OID_VECTOR => 0,
|
||||
Type::OID_VECTOR | Type::INT2_VECTOR => 0,
|
||||
_ => 1,
|
||||
};
|
||||
|
||||
|
@ -750,3 +750,14 @@ async fn oidvector() {
|
||||
)
|
||||
.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