This is an old revision of the document!


MySQL to PostgreSQL Migration Reference

Technical information on migration from MySQL to PostgreSQL.

Last Update: MySQL 5.6 and PostgreSQL 9.2

MySQL to PostgreSQL Migration Tools

Data Types

Converting built-in SQL data types:

MySQL PostgreSQL
1 INT(m) 32-bit integer INT

CREATE TABLE Statement

Converting CREATE TABLE statement keywords and clauses:

MySQL PostgreSQL
1 AUTO_INCREMENT column property Sequence and DEFAULT nextval('seq_name')
2 COLLATE name Removed

Storage and table attributes:

MySQL PostgreSQL
1 AUTO_INCREMENT = start_value table option ALTER SEQUENCE seq_name RESTART WITH start_value

Other SQL Statements

Converting other SQL statements:

MySQL PostgreSQL
1 CREATE DATABASE [IF NOT EXISTS] name CREATE DATABASE name
2 DROP TABLE [IF EXISTS] table DROP TABLE [IF EXISTS] table