Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres Numeric -> BigDecimal exception #980

Open
subkanthi opened this issue Jan 29, 2025 · 5 comments
Open

Postgres Numeric -> BigDecimal exception #980

subkanthi opened this issue Jan 29, 2025 · 5 comments
Assignees
Labels
dev-complete Development completed lightweight Issues related to Lightweight version
Milestone

Comments

@subkanthi
Copy link
Collaborator

subkanthi commented Jan 29, 2025

Exception:

Error persisting records to ClickHousejava.lang.RuntimeException: java.lang.IllegalArgumentException: BigDecimal(-57896044618658100000000000000000000000000000000000000000000000000000000000000000000000000) should be between -10000000000000000000000000000000000000000000000000000000000000000000000000000 and 10000000000000000000000000000000000000000000000000000000000000000000000000000 exclusive of both values
@subkanthi subkanthi added this to the 2.5.1 milestone Jan 29, 2025
@subkanthi
Copy link
Collaborator Author

postgresql numeric datatype

-57896044618658100000000000000000000000000000000000000000000000000000000000000000000000000

@subkanthi subkanthi self-assigned this Jan 29, 2025
@subkanthi subkanthi added the lightweight Issues related to Lightweight version label Jan 29, 2025
@subkanthi
Copy link
Collaborator Author

Postgres version: 14.15

@subkanthi
Copy link
Collaborator Author

Currently numeric postgres datatypes are mapped to Decimal(64,18).
The limit is currently enforced by Clickhouse-jdbc library.

@subkanthi
Copy link
Collaborator Author


CREATE TABLE test_numeric
(
    `amount` Decimal(64, 18)
)
ENGINE = MergeTree
ORDER BY amount

Query id: f1885bbf-3f31-42fd-9799-9f0bbfe4558d

Ok.

0 rows in set. Elapsed: 0.004 sec. 

42125f6acaa6 :) insert into test_numeric values(-57896044618658100000000000000000000000000000000000000000000000000000000000000000000000000)

INSERT INTO test_numeric FORMAT Values

Query id: 73782c5b-9632-4f51-8031-a64afe285788

Ok.
Exception on client:
Code: 69. DB::Exception: Too many digits (65 > 64) in decimal value:  at row 0: While executing ValuesBlockInputFormat: data for INSERT was parsed from query. (ARGUMENT_OUT_OF_BOUND)

@subkanthi
Copy link
Collaborator Author

Decimal256

42125f6acaa6 :) create table test_numeric(amount Decimal256(76)) ENGINE=MergeTree order by amount;

CREATE TABLE test_numeric
(
    `amount` Decimal256(76)
)
ENGINE = MergeTree
ORDER BY amount

Query id: 8d4f5b37-a35d-4146-bf07-4a60a4858003

Ok.

0 rows in set. Elapsed: 0.007 sec. 

42125f6acaa6 :) insert into test_numeric values(-57896044618658100000000000000000000000000000000000000000000000000000000000000000000000000)

INSERT INTO test_numeric FORMAT Values

Query id: 69a5cdb0-817f-4553-8047-391e89642940

Ok.
Exception on client:
Code: 69. DB::Exception: Too many digits (77 > 76) in decimal value:  at row 0: While executing ValuesBlockInputFormat: data for INSERT was parsed from query. (ARGUMENT_OUT_OF_BOUND)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev-complete Development completed lightweight Issues related to Lightweight version
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant