Skip to content

Clarification on postgres_ty_for_value weird type values #253

@RoyalFoxy

Description

@RoyalFoxy

Looking through the Postgres driver I saw that the postgres_ty_for_value returns the Postgres type for a specific value type.

Taking a closer look however at the number types makes me a bit confused.

fn postgres_ty_for_value(value: &stmt::Value) -> Type {
    match value {
        // ...
        stmt::Value::I8(_) => Type::INT2,
        stmt::Value::I16(_) => Type::INT2,
        stmt::Value::I32(_) => Type::INT4,
        stmt::Value::I64(_) => Type::INT8,
        stmt::Value::U8(_) => Type::INT2,
        stmt::Value::U16(_) => Type::INT4, // <- Shouldn't this be Type::INT2 ?
        stmt::Value::U32(_) => Type::INT8, // <- Shouldn't this be Type::INT4 ?
        stmt::Value::U64(_) => Type::INT8,
        // ...
        _ => todo!("postgres_ty_for_value: {value:#?}"),
    }
}

I think this just slipped through the quality control of the quite massive change of #159 which got added to main with this commit e30a79a

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions