Import and Export data

export:

pg_dump -h localhost -p 5432 -U user -d database_name  -f pg_dump.sql

import:

psql -h localhost -d database_name -U user -p 5432 -f pg_dump.sql


Notes:

- the geospatial data : need install postgis in postgres (or use postgis/postgis image instead of postgres image in docker)

- make sure to the destination server have similar users/roles as the source server

Comments

Popular posts from this blog

PostgreSQL CREATE INDEX Statement

Understanding LIKE vs ILIKE in PostgreSQL