Skip to content

Documentation or fix for Decimal type #13

@EthanLozano

Description

@EthanLozano

Bridges' documentation should nudge the user from Decimal to Double, or SwifQL/Bridges should appropriately translate a swift Double to a Postgres decimal/numeric.

I had a table column declared with a Decimal swift type:

    @Column("my_decimal")
    var myDecimal: Decimal

and I received the following error

column "my_decimal" is of type numeric but expression is of type text (transformAssignedExpr)

I enabled Bridges debugging, and the prepared statement showed a quoted value (i.e. "250")

After snooping around in SwifQL's Type+Autodetect.swift, I noticed that a swift Double translates to a Postgres decimal/numeric. My code started working when I changed the variable type from Decimal to a Double:

    @Column("my_decimal")
    var myDecimal: Double

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