MySQL → PostgreSQL
Convert MySQL TIMESTAMP to PostgreSQL timestamptz
MySQL TIMESTAMP values are stored in UTC and rendered in the session time zone — semantically closest to PostgreSQL's timestamptz.
TIMESTAMP → timestamptz
What to know
- TIMESTAMP → timestamptz keeps the point-in-time meaning
- ON UPDATE CURRENT_TIMESTAMP has no direct equivalent — recreate it with a trigger
- DEFAULT CURRENT_TIMESTAMP carries over as DEFAULT now()
- Zero timestamps become NULL (PostgreSQL rejects them)
Before / after
MySQL
CREATE TABLE posts (
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
); PostgreSQL
CREATE TABLE posts (
created_at timestamptz DEFAULT now()
); Don't convert column-by-column — convert the whole database.
Upload a dump, get back ready-to-import SQL with this mapping (and every other one) applied.
Open the MySQL → PostgreSQL converterSee the full type mapping table or all guides.