PostgreSQL database design

Quick start guide for PostgreSQL database design.

1. New project

To create a new project, click New on the main toolbar and select the PostgreSQL project type.

2. Add tables

Basic database objects can be added to your project/diagram by clicking the appropriate icon on the main toolbar.

adding new object to ERD for PostgreSQL

Then click the diagram area. A new graphical object will appear on the diagram.

Edit properties in Right Side panel:

Alternatively, you can double click the graphics or right-click the item and choose Edit to open a larger modal form.

Table properties

Basic type settings can be specified in the section Details.


In section Columns, you can add new table columns. Specify new column name, datatype, enum, domain and click Add.

  • PK indicates primary key.
  • NN represents Not Null column.

Detailed column specifics can be defined in a collapsible/expandable area.

Table columns - PostgreSQL

Note: Sample data will appear in the diagram if the Sample data mode is activated.

3. Views, enums, procedures, functions, domains, rules, policies and other objects

All other supported objects can be added to the diagram either by clicking the Other icon on the main toolbar, selecting the object type and then clicking the diagram area or, by right-clicking the diagram area and selecting the desired object type.

context menu

After adding the object to the diagram you can double click it and edit properties or use the right side panel for making modifications.

Enum in PostgreSQL

Example: the created mpaa_rating object can be selected from the data type drop-down list. This way you can easily reuse the same enum in different columns.

Selection of enums in PostgreSQL ER diagram

4. Relationships

Relationships can be created between parent and child tables (for other visual references you can use Lines and connect two graphical objects).

To add a new relationship to the diagram, click the Relationship icon, then click the parent table and then the child table. If the primary key is defined in the parent table, a new column will be added to the child table and marked as a foreign key.

Example: relationship drawn from table customer to table cart. Foreign key column customer_id was added to the child table automatically.

relationship in ERD for postgreSQL

Read more about one-to-many relationships and many-to-many relationships.

5. Code generation

To generate an SQL script, click the SQL Script icon on the main toolbar.

generated SQL script

How to execute the script? Use another tool, for example, PG Admin:

PG admin dark theme

6. Other features and visual elements

Notes, lines and other information that can be displayed in a diagram will help you keep the structure well documented. You can also display descriptions instead of columns in the visualisations.

descriptions displayed instead of columns

7. Reverse engineering and visualization of existing database structures

You can establish a connection to your PostgreSQL database and load the existing structure, incl. all supported PostgreSQL objects.

To reverse engineer a database, create a new connection:

database connection

Your new connection will appear in page Connection where you can also filter connections by name or platform.

To load the structure click Connect and load existing database structure.

a list of postgresSQL database connections



Quick links

Free Trial Buy Now!