Skip to content

sql: binary protocol bug with decimal #25460

@tlvenn

Description

@tlvenn

I am trying to store some decimal values using Elixir / Ecto and it seems CRDB is not decoding the passed value properly:

The discount field is defined as DECIMAL(13,4) in the table.

On Elixir/Ecto side

INSERT INTO "passes" ("discount", ...) VALUES ($1, ...) [#Decimal<15>, ...]

On CRDB side:

"INSERT INTO passes(discount, ...) VALUES ($1, ...)" {$1:"1500000.0000", ...} 1.047 1 ""

CRDB info:

❯ cockroach version
Build Tag:    v2.0.1
Build Time:   2018/04/23 19:18:28
Distribution: CCL
Platform:     darwin amd64 (x86_64-apple-darwin17.5.0)
Go Version:   go1.10.1
C Compiler:   4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.1)
Build SHA-1:  c92bc6e912880c28c0784d3208583fb27f482f76
Build Type:   development

Metadata

Metadata

Labels

A-sql-pgwirepgwire protocol issues.C-investigationFurther steps needed to qualify. C-label will change.O-communityOriginated from the communityS-3-erroneous-edge-caseDatabase produces or stores erroneous data without visible error/warning, in rare edge cases.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions