-
Notifications
You must be signed in to change notification settings - Fork 209
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
fix: Postgres DB with non-UTC timezone incorrectly parse in timestamptz fields #252
fix: Postgres DB with non-UTC timezone incorrectly parse in timestamptz fields #252
Conversation
…Time(t) output in timestamptz fields
@@ -25,7 +25,7 @@ func (d postgreSQL) EncodeBool(b bool) string { | |||
} | |||
|
|||
func (d postgreSQL) EncodeTime(t time.Time) string { | |||
return MySQL.EncodeTime(t) | |||
return `'` + t.Format(time.RFC3339Nano) + `'` |
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.
Could you update dialect.go timeFmt instead so that it is available in all dialects?
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 tested this format with the rest of the bases, MySQL (5.6) and MS SQL (2017) cannot parse time in this format. I suggest using the new format for PostgreSQL, leaving the old implementation for MySQL, SQLite and MS SQL.
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.
@taylorchu As I pointed out in the comment above, other bases understand a very limited number of formats, I suggest making changes only for Postgres methods.
#251