Convert a Oracle schema to PostgreSQL
Paste the CREATE TABLE statements from Oracle and ERD Designer draws them as a diagram. Change the diagram's target database to PostgreSQL and every column's datatype is converted. You review each change before it is applied, then generate the PostgreSQL script.
What changes in the sample
Converted to PostgreSQL 17, these columns of the sample above change type. Everything else keeps its type; names, keys, nullability and lists of allowed values are left as they are.
| Column | Oracle | PostgreSQL | Note |
|---|---|---|---|
CUSTOMERS.CUSTOMER_ID | NUMBER identity | BIGSERIAL | |
CUSTOMERS.EMAIL | VARCHAR2(255) | VARCHAR(255) | |
CUSTOMERS.FULL_NAME | NVARCHAR2(120) | VARCHAR(120) | |
CUSTOMERS.NOTES | CLOB | TEXT | |
CUSTOMERS.CREATED_AT | DATE | TIMESTAMP(0) | default: SYSDATE → CURRENT_TIMESTAMP |
ORDERS.ORDER_ID | NUMBER identity | BIGSERIAL | |
ORDERS.CUSTOMER_ID | NUMBER | BIGINT | |
ORDERS.STATUS | VARCHAR2(20) | VARCHAR(20) | |
ORDERS.TOTAL | NUMBER(12,2) | NUMERIC(12,2) | |
ORDERS.PLACED_AT | TIMESTAMP(6) WITH TIME ZONE | TIMESTAMPTZ(6) | |
ORDERS.RECEIPT_PDF | BLOB | BYTEA |
The sample converts with nothing to warn about. A schema that loses something on the way — a time zone, a precision, a type PostgreSQL does not have — gets a message naming the column and what changed.
The PostgreSQL script
This is what ERD Designer generates for the sample, for PostgreSQL 17. Our test suite applies this conversion to a real PostgreSQL server and then reads the database back to confirm it matches the diagram exactly.
-- Create table CUSTOMERS
CREATE TABLE "CUSTOMERS" (
"CUSTOMER_ID" BIGSERIAL NOT NULL,
"EMAIL" VARCHAR(255) NOT NULL,
"FULL_NAME" VARCHAR(120) NOT NULL,
"NOTES" TEXT,
"CREATED_AT" TIMESTAMP(0) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "CUSTOMERS_PK" PRIMARY KEY ("CUSTOMER_ID")
);
-- Create table ORDERS
CREATE TABLE "ORDERS" (
"ORDER_ID" BIGSERIAL NOT NULL,
"CUSTOMER_ID" BIGINT NOT NULL,
"STATUS" VARCHAR(20) NOT NULL DEFAULT 'new' CHECK ("STATUS" IN ('new', 'paid', 'shipped')),
"TOTAL" NUMERIC(12,2) NOT NULL,
"PLACED_AT" TIMESTAMP(6) WITH TIME ZONE NOT NULL,
"RECEIPT_PDF" BYTEA,
CONSTRAINT "ORDERS_PK" PRIMARY KEY ("ORDER_ID")
);
-- Add unique constraint on CUSTOMERS (EMAIL)
ALTER TABLE "CUSTOMERS" ADD CONSTRAINT "CUSTOMERS_UQ1" UNIQUE ("EMAIL");
-- Create index on ORDERS (PLACED_AT)
CREATE INDEX "ORDERS_PLACED_IX" ON "ORDERS" ("PLACED_AT");
-- Add foreign key ORDERS (CUSTOMER_ID) → CUSTOMERS (CUSTOMER_ID)
ALTER TABLE "ORDERS" ADD CONSTRAINT "ORDERS_FK1" FOREIGN KEY ("CUSTOMER_ID") REFERENCES "CUSTOMERS" ("CUSTOMER_ID");
How to convert your own schema
- Paste your Oracle script above and press Open in ERD Designer. The diagram opens laid out and ready to edit.
- Click the diagram's name in the toolbar to open its properties, choose PostgreSQL under Target Database / Version, and press Apply Changes.
- If PostgreSQL offers more than one way to store a kind of column, choose one and press Continue.
- Read the list of retyped columns and any warnings, then press Apply Conversion. Save the diagram to keep it.
- Press Generate DDL (the database icon) to copy or download the PostgreSQL script — or apply it to a database on your own network with the ERD Designer Agent.
What it reads, and what it does not
- It reads
CREATE TABLE,ALTER TABLE … ADD CONSTRAINTandCREATE INDEX: tables, columns, keys, foreign keys, unique constraints, check lists and indexes. Anything else in the script is skipped and listed. - It converts the schema, never the data: no rows are read, moved or changed.
- It does not convert views, stored procedures, functions, triggers or packages.
Which plan you need
Pasting a script and working with it as a diagram is free on the Basic plan, with no card. Converting a diagram to another database is part of the Pro and Advanced plans, which also generate its script and can apply it through the Agent.
Other conversions
- Oracle to SQL Server
- Oracle to MySQL
- Oracle to MariaDB
- Oracle to SQLite
- Oracle to Amazon Redshift
- Oracle to Google BigQuery
- Oracle to Snowflake
- SQL Server to PostgreSQL
- MySQL to PostgreSQL
- MariaDB to PostgreSQL
- SQLite to PostgreSQL
- Amazon Redshift to PostgreSQL
- Google BigQuery to PostgreSQL
- Snowflake to PostgreSQL
Questions? Write to support@erddesigner.com. · ERD Designer · Terms · Privacy