Skip to content

Fix PostgreSQL Date32 values not being correctly read - #95999

Merged
alexey-milovidov merged 1 commit into
masterfrom
fix-postgresql-date32-reading
Feb 5, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
fix-postgresql-date32-reading

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Feb 5, 2026 •

Copy link
Copy Markdown
Member

PostgreSQL DATE values outside the ClickHouse Date range (1970-2149) were being incorrectly read due to UInt16 overflow. This changes the PostgreSQL date type mapping from Date to Date32, which uses Int32 storage and supports dates from 1900-2299.

Changes:

  • Map PostgreSQL date type to Date32 instead of Date
  • Add Date32 support for reading PostgreSQL date arrays
  • Add Date32 support for writing date arrays back to PostgreSQL

Fixes #73084

Changelog category (leave one):

  • Backward Incompatible Change

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

DATE columns from PostgreSQL are now inferred as Date32 in ClickHouse (in previous versions they were inferred as Date, which led to overflow of the values outside of a narrow range). Allow inserting Date32 values back to PostgreSQL. Closes #73084.

Version info

  • Merged into: 26.2.1.270

PostgreSQL DATE values outside the ClickHouse `Date` range (1970-2149)
were being incorrectly read due to UInt16 overflow. This changes the
PostgreSQL `date` type mapping from `Date` to `Date32`, which uses Int32
storage and supports dates from 1900-2299.

Changes:
- Map PostgreSQL `date` type to `Date32` instead of `Date`
- Add `Date32` support for reading PostgreSQL date arrays
- Add `Date32` support for writing date arrays back to PostgreSQL

Fixes #73084

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Feb 5, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [d6111fb]

Summary: ❌

job_name test_name status info comment
Stress test (amd_msan) failure
Logical error: Unexpected return type from A. Expected B. Got C. Action: (STID: 1611-3d19) FAIL cidb, issue
AST fuzzer (amd_ubsan) failure
Logical error: Block structure mismatch in A stream: different types: (STID: None) FAIL cidb

@clickhouse-gh clickhouse-gh Bot added the pr-backward-incompatible Pull request with backwards incompatible changes label Feb 5, 2026
@kssenii kssenii self-assigned this Feb 5, 2026
@alexey-milovidov
alexey-milovidov merged commit 5a2e5db into master Feb 5, 2026
127 of 129 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-postgresql-date32-reading branch February 5, 2026 17:10
@robot-ch-test-poll1 robot-ch-test-poll1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backward-incompatible Pull request with backwards incompatible changes pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Date32 values are not correctly read from PostgreSQL

3 participants