Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Support Arbitrary Precision Decimal Numbers #2

@theory

Description

@theory

Postgres JSONB parses numeric values into Arbitrary Precision Numbers, whereas Go's encoding/json package parses them into float64. Currently the AST separately parses integers and floats, and the executor will convert json.Number values into integers or floats. It's a bit complicated.

Consider adopting github.com/shopspring/decimal (or perhaps github.com/cockroachdb/apd) to unify the handling of all numeric values. Try to retain as much precision as possible, something like:

  • Path parser: Always convert numbers to arbitrary precision numbers
  • Executor: Always convert floats, ints, and json.Number values to arbitrary precision numbers

The goal is to then unify all numeric handling to use only arbitrary precision numbers with as much retained precision as possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions