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

Support TIMESTAMP_NS, TIMESTAMP_MS & TIMESTAMP_S #534

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

destrex271
Copy link

@destrex271 destrex271 commented Jan 15, 2025

Draft PR to support TIMESTAMP_NS, TIMESTAMP_MS & TIMESTAMP_S types available in duckdb in postgres.

Fixes #283

@destrex271
Copy link
Author

destrex271 commented Jan 15, 2025

Insert statements executed from postgres on tables in motherduck are working as expected for TIMESTAMP_MS & TIMESTAMP_S.

-- Tables created in Motherduck
CREATE TABLE timestamps_ms_tbl(a timestamp_ms);
CREATE TABLE timestamps_s_tbl(a timestamp_s);
-- ------------------------------------------------------------------------

-- Insert statements executed from postgres
INSERT INTO timestamps_ms_tbl VALUES('1992-12-12 12:12:12.1989898'::TIMESTAMP);
INSERT INTO timestamps_s_tbl VALUES('1992-12-12 12:12:12.1989898'::TIMESTAMP);

-- Selecting Data from mother duck via postgres
-- -------------------------------------------------------------------
SELECT * FROM timestamps_ms_tbl; 
-- Output:
-- 1992-12-12 12:12:12.198

SELECT * FROM timestamps_s_tbl;
-- Output
-- 1992-12-12 12:12:12

Currently working on converting TIMESTAMP_MS selected from duckdb into Postgres TIMESTAMP type

@destrex271 destrex271 marked this pull request as ready for review January 16, 2025 17:18
@destrex271
Copy link
Author

@JelteF, I tested this against some tables in Motherduck, but I’m not sure how to go about writing regression tests for this. From what I understand, the type_support tests are queries run from within PostgreSQL. Since this PR doesn’t add any new types to Postgres, I’m a bit confused about the best way to proceed.

@destrex271
Copy link
Author

Also unrelated to this issue, I noticed another problem while working on this:

image

As you can see, for some reason on motherduck timestamp_ns is being compressed to timestamp with micro second precision only.

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.

Support TIMESTAMP_NS, TIMESTAMP_MS & TIMESTAMP_S types
1 participant