-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem or challenge?
In postgres, to_timestamp
has signature to_timestamp ( text, text ) → timestamp with time zone
and to_timestamp ( double precision ) → timestamp with time zone
.
But we have query that has more than 2 arguments
datafusion/datafusion/sqllogictest/test_files/timestamps.slt
Lines 362 to 366 in 7ebd993
# to_timestamp with formatting | |
query I | |
SELECT COUNT(*) FROM ts_data_nanos where ts > to_timestamp('2020-09-08T12:00:00+00:00', '2020-09-08 12/00/00+00:00', '%c', '%+', '%Y-%m-%d %H/%M/%s%#z') | |
---- | |
2 |
Other than that the result seems different too.
Postgres
postgres=# select to_timestamp(1);
to_timestamp
---------------------------
1970-01-01 07:30:01+07:30
Duckdb
D select to_timestamp(1);
┌───────────────────────────┐
│ to_timestamp(1) │
│ timestamp with time zone │
├───────────────────────────┤
│ 1970-01-01 07:30:01+07:30 │
└───────────────────────────┘
Datafusion
query P
select to_timestamp(1);
----
1970-01-01T00:00:01
Describe the solution you'd like
Change the function signature to be consistent with Postgres.
Change the result to be consistent with Postgres.
Describe alternatives you've considered
No response
Additional context
Duckdb doesn't support (text, text) signature
D select to_timestamp('05 Dec 2000', 'DD Mon YYYY');
Binder Error: No function matches the given name and argument types 'to_timestamp(STRING_LITERAL, STRING_LITERAL)'. You might need to add explicit type casts.
Candidate functions:
to_timestamp(DOUBLE) -> TIMESTAMP WITH TIME ZONE
LINE 1: select to_timestamp('05 Dec 2000', 'DD Mon YYY...
https://www.postgresql.org/docs/current/functions-formatting.html
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request