Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd92b3b0

Browse files
committed
Fix int2vector serialization
1 parent8449e4d commitd92b3b0

File tree

2 files changed

+13
-2
lines changed
  • postgres-types/src
  • tokio-postgres/tests/test/types

2 files changed

+13
-2
lines changed

‎postgres-types/src/lib.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -910,9 +910,9 @@ impl<'a, T: ToSql> ToSql for &'a [T] {
910910
_ =>panic!("expected array type"),
911911
};
912912

913-
// Arrays are normally one indexed by default but oidvector*requires* zero indexing
913+
// Arrays are normally one indexed by default but oidvectorand int2vector *require* zero indexing
914914
let lower_bound =match*ty{
915-
Type::OID_VECTOR =>0,
915+
Type::OID_VECTOR|Type::INT2_VECTOR=>0,
916916
_ =>1,
917917
};
918918

‎tokio-postgres/tests/test/types/mod.rs‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,3 +750,14 @@ async fn oidvector() {
750750
)
751751
.await;
752752
}
753+
754+
#[tokio::test]
755+
asyncfnint2vector(){
756+
test_type(
757+
"int2vector",
758+
// NB: postgres does not support empty int2vectors! All empty arrays are normalized to zero dimensions, but the
759+
// oidvectorrecv function requires exactly one dimension.
760+
&[(Some(vec![0i16,1,2]),"ARRAY[0,1,2]"),(None,"NULL")],
761+
)
762+
.await;
763+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp