Re: Backing up a DB excluding certain tables

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: JORGE MALDONADO <jorgemal1960(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Backing up a DB excluding certain tables
Date: 2022-04-26 18:18:43
Message-ID: 90ad963d-11c3-a77b-9556-f6f5b0cc3b7e@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 4/26/22 12:15 PM, JORGE MALDONADO wrote:
> Hi,
>
> I am using *pg_dump* to backup a DB but I would like to exclude some
> tables so I added the *-T* switch with a pattern like this: *aspnet*.**.
> The backup command  includes the *-s* switch to consider the schema only
> because I do not need the data. However, even with the *-T* switch, the
> tables with the above pattern are created and I also want to exclude
> their creation. Is this possible? Or maybe I am not setting the pattern
> correctly. This is the command I am issuing:
>
> pg_dump -E win1252 -f c:/temp/respaldo.backup -F p -n riopoderoso -h
> localhost -p 5432 -U postgres -W -T aspnet*.* -s riopoderoso

Try:

-T 'aspnet*.*'

Per:

https://www.postgresql.org/docs/current/app-pgdump.html

"When using wildcards, be careful to quote the pattern if needed to
prevent the shell from expanding the wildcards; see Examples below."

And Examples is:

https://www.postgresql.org/docs/current/app-pgdump.html#PG-DUMP-EXAMPLES
>
> Respectfully,
> Jorge Maldonado

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message andrew cooke 2022-04-26 18:26:15 How many max_replication_slots?
Previous Message alias 2022-04-26 16:43:43 row level security on conflict do update