Re: pg_dump'ed file contains "DROP DATABASE"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pf(at)pfortin(dot)com
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: pg_dump'ed file contains "DROP DATABASE"
Date: 2023-02-20 18:35:57
Message-ID: 3630676.1676918157@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

pf(at)pfortin(dot)com writes:
> The other day, I restored his first file with:
> pg_restore --host "localhost" --port "5432" --username "postgres"
> --no-password --dbname "myname" --create --clean --verbose "dumpfile"

> Was my 134 table[1] myname DB saved because it was open?

Yup.

> If the dump file
> contains the above statements, how can I be absolutely certain I won't
> lose the DB?

Reading the manual is advisable. --create --clean specifies exactly
that the target database is to be dropped and recreated.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2023-02-20 19:06:34 Re: pg_dump'ed file contains "DROP DATABASE"
Previous Message pf 2023-02-20 18:27:05 pg_dump'ed file contains "DROP DATABASE"