-
-
Notifications
You must be signed in to change notification settings - Fork 495
Add support for time-0.2 types #580
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
Conversation
postgres-types/src/lib.rs
Outdated
@@ -391,6 +397,10 @@ impl WrongType { | |||
/// | `chrono::DateTime<FixedOffset>` | TIMESTAMP WITH TIME ZONE | | |||
/// | `chrono::NaiveDate` | DATE | | |||
/// | `chrono::NaiveTime` | TIME | | |||
/// | `time::PrimitiveDateTime` | TIMESTAMP | | |||
/// | `time::OffsetDateTime` | TIMESTAMP, TIMESTAMP WITH TIME ZONE | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should only support TIMESTAMP WITH TIME ZONE to align with chrono.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chrono's types embed specific timezones (or rather UTC
vs Local
) where as OffsetDateTime
doesn't have the generic component and is compatible with both TIMESTAMP
and TIMESTAMPZ
. I'd prefer to be able to use OffsetDateTime
with TIMESTAMP
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to be able to use OffsetDateTime with TIMESTAMP.
With cockroach TIMESTAMP
will always be UTC
. I'm still looking for clarification on postgres's behavior. I think with the fact that we're explicitly setting the session to UTC
, it should be OK either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sfackler I thought about this some more and came to the same conclusion. OffsetDateTime
now only supports TIMESTAMPTZ
in the latest commit. Do you want me to squash these commits?
Can you add tests as well? |
Ah! I just found the type tests under |
No need to squash! |
Thanks! |
This is essentially ported from the
chrono
implementation.