SQLines provides tools to help you transfer data, convert database schema (DDL), views, stored procedures and functions, triggers, queries, embedded SQL statements and SQL scripts from MySQL to PostgreSQL.
Databases:
Converting SQL language elements:
MySQL | PostgreSQL | |||
1 | -- | # | Single line comment | -- |
Other:
Converting character data types:
MySQL | PostgreSQL | ||
1 | LONGTEXT | Character large object, <= 4 Gb | TEXT |
Converting numeric data types:
MySQL | PostgreSQL | ||
1 | DECIMAL(p, s) | Fixed-point number | DECIMAL(p, s) |
2 | FLOAT(p, s) | Single-precision floating point | FLOAT(p) |
3 | INT(m) | 32-bit integer | INT |
4 | NUMERIC(p, s) | Fixed-point number | NUMERIC(p, s) |
Converting datetime data types:
MySQL | PostgreSQL | ||
1 | DATETIME(p) | Date and time data with fraction, p <= 6, default is 0 | TIMESTAMP(p) |
2 | TIMESTAMP(p) | Date and time data with fraction in UTC ![]() | TIMESTAMP(p) |
Converting binary data types:
MySQL | PostgreSQL | ||
1 | LONGBLOB | Binary large object, <= 4 Gb | BYTEA |
2 | TINYBLOB | Binary data, <= 255 bytes | BYTEA |
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 |
2 | ENGINE = engine_name | Removed |
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 |