-
-
Notifications
You must be signed in to change notification settings - Fork 935
Reflect on column type for writing formatting time #391
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
Use Postgres' preferred forms for date (no time) and time with and without zone for writing those columns. Previously, these column types could not be written, with the error: > pq: invalid input syntax for type time: "0001-01-01T17:00:00Z BC" This change prevents that error. From [Postgresql docs]: > The time-of-day types are time [ (p) ] without time zone and time [ > (p) ] with time zone. time alone is equivalent to time without time > zone. The date type represents only a day. The other types, timestamp with and without time zone, were previously functioning correctly. [Postgresql docs]: http://www.postgresql.org/docs/9.4/static/datatype-datetime.html
|
This doesn't seem like a good idea. Anything that requires looking at the inferred type for a parameter is going to work differently between prepared statements and single round-trip executions (in |
It seems like a good portion of the types managed in The current behavior is a confusing error message for any |
That'd be exactly two types, and backwards compatibility with that poor decision is exactly why we had to implement the
A wrapper for time.Time which implements Valuer sounds like the best option here. Not sure what to call it, though; pq.Time is not almost certainly not a good idea since it's too easy to confuse with the wide range of functionality supported by time.Time. |
I called it |
|
Not a bad name. Could also use pg's names: |
Use Postgres' preferred forms for date (no time) and time with and without
zone for writing those columns. Previously, these column types could not be
written, with the error:
This change prevents that error.
From Postgresql docs:
The date type represents only a day.
The other types, timestamp with and without time zone, were previously
functioning correctly.