Altinity / clickhouse-sink-connector

Replicate data from MySQL, Postgres and MongoDB to ClickHouse
https://www.altinity.com
Apache License 2.0
214 stars 48 forks source link

numeric datatype in postgres mapped to Decimal(10,2) in ClickHouse #713

Closed subkanthi closed 1 month ago

subkanthi commented 1 month ago

numeric datatype in postgres mapped to Decimal(10,2) in ClickHouse, the precision should not be 2 and it should be higher.

subkanthi commented 1 month ago

PostgreSQL documentation

without any precision or scale creates an “unconstrained numeric” column in which numeric values of any length can be stored, up to the implementation limits. A column of this kind will not coerce input values to any particular scale, whereas numeric columns with a declared scale will coerce input values to that scale. (The SQL standard requires a default scale of 0, i.e., coercion to integer precision. We find this a bit useless. If you're concerned about portability, always specify the precision and scale explicitly.)

subkanthi commented 1 month ago

numeric datatype with default scale, precision mapped to Decimal(64, 18) in ClickHouse. numeric datatype with explicit scale precision should passed to Clickhouse. Example. numeric(21,5) -> numeric(21, 5) in ClickHouse.

subkanthi commented 1 month ago

Implemeted in #715.