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

Fix serialization of oidvector#1027

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
sfackler merged 1 commit intomasterfromoidvector
May 1, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletionpostgres-types/src/lib.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -910,9 +910,15 @@ impl<'a, T: ToSql> ToSql for &'a [T] {
_ => panic!("expected array type"),
};

// Arrays are normally one indexed by default but oidvector *requires* zero indexing
let lower_bound = match *ty {
Type::OID_VECTOR => 0,
_ => 1,
};

let dimension = ArrayDimension {
len: downcast(self.len())?,
lower_bound: 1,
lower_bound,
};

types::array_to_sql(
Expand Down
4 changes: 3 additions & 1 deletiontokio-postgres/src/connect_socket.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,9 @@ pub(crate) async fn connect_socket(
host: &Host,
port: u16,
connect_timeout: Option<Duration>,
tcp_user_timeout: Option<Duration>,
#[cfg_attr(not(target_os = "linux"), allow(unused_variables))] tcp_user_timeout: Option<
Duration,
>,
keepalive_config: Option<&KeepaliveConfig>,
) -> Result<Socket, Error> {
match host {
Expand Down
11 changes: 11 additions & 0 deletionstokio-postgres/tests/test/types/mod.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -739,3 +739,14 @@ async fn ltxtquery_any() {
)
.await;
}

#[tokio::test]
async fn oidvector() {
test_type(
"oidvector",
// NB: postgres does not support empty oidarrays! All empty arrays are normalized to zero dimensions, but the
// oidvectorrecv function requires exactly one dimension.
&[(Some(vec![0u32, 1, 2]), "ARRAY[0,1,2]"), (None, "NULL")],
)
.await;
}

[8]ページ先頭

©2009-2025 Movatter.jp