Skip to content

Validate Decimal precision and scale before swapping - #553

Merged
slabko merged 2 commits into
ClickHouse:masterfrom
fallintoplace:fix/validate-decimal-swap
Aug 24, 2026
Merged

Validate Decimal precision and scale before swapping#553
slabko merged 2 commits into
ClickHouse:masterfrom
fallintoplace:fix/validate-decimal-swap

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

What does this PR do?

  • Validate Decimal precision and scale before ColumnDecimal::Swap() swaps the backing column.
  • Throw ValidationError when either value differs.
  • Add regression tests for matching and mismatching Decimal columns.

Why?

ColumnDecimal caches the backing storage type and keeps the scale in its type. Swapping columns with different precision or scale can make the backing data and metadata disagree.

Tests

  • ./build/ut/clickhouse-cpp-ut --gtest_filter="ColumnsCase.DecimalSwap*"
  • ./build/ut/clickhouse-cpp-ut --gtest_filter="ColumnsCase.*"

Related to #552

@slabko
slabko merged commit 28c48d2 into ClickHouse:master Aug 24, 2026
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants