Skip to content

[2026-06-24T02:52:05Z INFO sqlx_gen] Connecting to PostgreSQL database... Error: Database(ColumnDecode { index: "5", source: "mismatched types; Rust type i32 (as SQL type INT4) is not compatible with SQL type INT2" }) make: *** [sqlx-models] Error 1 #4

Description

@csdog

cursor give me one patch when use postgresql for resolve this problem

--- a/src/introspect/postgres.rs
+++ b/src/introspect/postgres.rs
@@ -431,7 +431,7 @@ async fn fetch_composite_types(
     pool: &PgPool,
     schemas: &[String],
 ) -> Result<Vec<CompositeTypeInfo>> {
-    let rows = sqlx::query_as::<_, (String, String, String, String, String, i32)>(
+    let rows = sqlx::query_as::<_, (String, String, String, String, String, i16)>(
         r#"
         SELECT
             n.nspname AS schema_name,
@@ -483,7 +483,7 @@ async fn fetch_composite_types(
             udt_schema: None,
             is_nullable: nullable == "YES",
             is_primary_key: false,
-            ordinal_position: ordinal,
+            ordinal_position: i32::from(ordinal),
             schema_name: schema,
             column_default: None,
         });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions