Skip to content

Consider changing the way postgres composite types are stored #67

@doughsay

Description

@doughsay

I'd like to know what the motivation behind storing the numeric amount in postgres composite types as a numeric(20,8) is. With this setup, storing "USD 10.00" for example, turns into "USD 10.00000000" in the db, and then when retrieving it, it retains the precision.

I wanted more control over how much precision is stored for certain columns. I changed the composite money type from what the readme mentions:

CREATE TYPE public.money_with_currency AS (currency_code char(3), amount numeric(20,8))

To this:

CREATE TYPE public.money_with_currency_new AS (currency char(3), amount numeric)

It works much better for my use cases. Is there any reason why this shouldn't be the default?

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