postgresql dump and restore

less than 1 minute read

postgresql dump and restore

pg dump

psql -d sewsmart -U sewsmart  -c "\copy (select * from daily_production_source where date(gen_time) >= '2025-08-01' and date(gen_time) <= '2025-08-05') TO 'daily_production_source_2025_08.csv' WITH CSV HEADER"

pg restore

psql -d sewsmart -U sewsmart  -c "\COPY daily_production_source FROM 'daily_production_source_2025_08.csv' WITH (FORMAT CSV, HEADER)"

Comments