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

Mysql datetime has no time zone. #1514

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sdyarnell
Copy link

To ensure consistent behavior across applications, database types should remain as consistent as possible.

MySQL datetime does not have a time zone. The appropriate PostgreSQL type is timestamp.

Caveat: I have no clue what I'm doing.

@df7cb
Copy link
Collaborator

df7cb commented Jul 29, 2023

-1. The default aka sane timestamp type to use in PostgreSQL is timestamptz, and if Mysql lacks the TZ info, migrating to PG is the perfect opportunity to add it. (Note that timestamptz doesn't actually store the timezone, it just adds it for input/output.)

https://wiki.postgresql.org/wiki/Don%27t_Do_This#Don.27t_use_timestamp_.28without_time_zone.29

@sdyarnell
Copy link
Author

The issue would be going throughout the massive application to account for this change in the database.

As this is a database migration tool, database optimizations based on postgres recommendations do not feel like they align with the tool when they alter the behavior.

Also, I could not get pgloader to parse the following, or I probably would have never got here lol --

type datetime when default "0000-00-00 00:00:00" and not null
to timestamp drop not null drop default
using zero-dates-to-null

Is it because there are 2 guards?

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.

2 participants