Re: Backing up a DB excluding certain tables

From: JORGE MALDONADO <jorgemal1960(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Backing up a DB excluding certain tables
Date: 2022-05-04 17:12:38
Message-ID: CAAY=A7-waAUWfZtrvhpV+pykW2N-P9zLkOhxbPoQoXY_BXHXkA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

I just found the solution (or 1 solution).
It seems that the problem resides in tables with names containing
characters other than lowercase letters.
I want to exclude the following tables from the backup:

- AspNetRoleClaims
- AspNetRoles
- AspNetUserClaims
- AspNetUserLogins
- AspNetUserRoles
- AspNetUserTokens
- AspNetUsers
- __EFMigrationsHistory

One pg_dump command that worked correctly is as follows:

pg_dump -f c:/temp/respaldo.backup -n riopoderoso -F p -h localhost -p 5433
-U postgres -W -s *-T *.?sp?et* -T *.*igrations?istory* riopoderoso

As you can see, uppercase letters and underscore characters were avoided in
both -T arguments. In this way, the dumped file was generated successfully
without the files listed above.
It was not even necessary to issue the command *cmd.exe /c chcp 1252 *in
the command prompt before running pg_dump.
I also tried different combinations of single quotes and double quotes but
none worked.

This behavior of characters other than lowercase letters in table names is
present no matter if the database is originally created with UTF8 encoding.
The problem persists in such a case too.

Regards,
Jorge Maldonado

On Tue, May 3, 2022 at 11:12 AM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
wrote:

> On 5/3/22 10:26 AM, JORGE MALDONADO wrote:
> > I included the space in chcp 1252, it was a typo in the last message I
> sent.
> > This is what I just did as per your suggestion in a command prompt with
> > Lucida Console font.
> >
> > C:\Users\JorgeMal>chcp
> > Active code page: 437
> >
> > C:\Users\JorgeMal>cmd.exe /c chcp 1252
> > Active code page: 1252
> >
> > C:\Users\JorgeMal>chcp
> > Active code page: 1252
> >
>
> >
> > The result always included tables with *AspNet* in the name.
>
> I am at a loss for an answer. I just don't use Windows enough to know
> where to go from here.
>
> >
> > Regards,
> > Jorge Maldonado
> >
> >
>
> >
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alexander Farber 2022-05-04 17:16:08 Re: Displaying chat by punished users only to themselves (db fiddle attached)
Previous Message David G. Johnston 2022-05-04 16:17:27 Re: Displaying chat by punished users only to themselves (db fiddle attached)