Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Cockroach Native Query problem #664

Merged
merged 2 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all 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: 4 additions & 4 deletions crates/configuration/src/version4/native_operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ pub async fn oids_to_typenames(
for row in rows {
let schema_name: String = row.schema_name;
let type_name: String = row.type_name;
let oid: i64 = row.oid.into();
let oid: i64 = row.oid;

let mut found = false;
for (scalar_type_name, info) in &configuration.metadata.scalar_types.0 {
Expand Down Expand Up @@ -207,15 +207,15 @@ const OID_QUERY: &str = "
SELECT
typnamespace::regnamespace::text as schema_name,
typname as type_name,
oid::integer
oid::INT8
FROM pg_type
WHERE oid in (SELECT unnest($1))
WHERE oid::INT8 in (SELECT unnest($1::INT8[]))
";

/// Representation of a result row returned from the oid lookup query.
#[derive(Debug, sqlx::FromRow)]
struct OidQueryRow {
schema_name: String,
type_name: String,
oid: i32,
oid: i64,
}
8 changes: 4 additions & 4 deletions crates/configuration/src/version5/native_operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ pub async fn oids_to_typenames(
for row in rows {
let schema_name: String = row.schema_name;
let type_name: String = row.type_name;
let oid: i64 = row.oid.into();
let oid: i64 = row.oid;

let mut found = false;
for (scalar_type_name, info) in &configuration.metadata.types.scalar.0 {
Expand Down Expand Up @@ -212,15 +212,15 @@ const OID_QUERY: &str = "
SELECT
typnamespace::regnamespace::text as schema_name,
typname as type_name,
oid::integer
oid::INT8
FROM pg_type
WHERE oid in (SELECT unnest($1))
WHERE oid::INT8 in (SELECT unnest($1::INT8[]))
";

/// Representation of a result row returned from the oid lookup query.
#[derive(Debug, sqlx::FromRow)]
struct OidQueryRow {
schema_name: String,
type_name: String,
oid: i32,
oid: i64,
}
Loading