Skip to content

Have chDB use postgres session's TimeZone - #101

Merged
serprex merged 1 commit into
mainfrom
session-timezone
Oct 7, 2026
Merged

serprex merged 1 commit into
mainfrom
session-timezone

Conversation

@serprex

@serprex serprex commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

depends on ClickHouse/pg-clickhouse-c/pull/39

timestamp without timezone columns currently parses as UTC, then shifts into PostgreSQL session TimeZone. eg noon under America/Los_Angeles during DST produces 05:00

Setting session_timezone on CH, and not defining destination type with explicit UTC, preserves Postgres TimeZone on CH

@serprex
serprex force-pushed the session-timezone branch 3 times, most recently from d26c82b to 68500b6 Compare October 7, 2026 05:46
@serprex
serprex marked this pull request as ready for review October 7, 2026 17:51
@serprex
serprex requested a review from theory October 7, 2026 17:51
CREATE TABLE naive (id INT, ts TEXT, tstz TEXT);
INSERT INTO naive VALUES (1, '2026-08-28 12:00:00', '2026-08-28 12:00:00');
COPY naive TO :'naive_url';
SET timezone TO 'America/Los_Angeles';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the default in pg_regress, FWIW.

Comment thread test/expected/timestamp.out Resolved
Comment thread CHANGELOG.md Resolved
Comment thread CHANGELOG.md Resolved
Comment thread test/expected/timestamp.out Resolved
`timestamp without timezone` columns currently parses as UTC,
then shifts into PostgreSQL session TimeZone.
eg noon under America/Los_Angeles during DST produces 05:00

Setting session_timezone on CH,
and not defining destination type with explicit UTC,
preserves Postgres TimeZone on CH
@serprex
serprex merged commit f29444f into main Oct 7, 2026
81 of 87 checks passed
@serprex
serprex deleted the session-timezone branch October 7, 2026 20:21
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