Re: Backing up a DB excluding certain tables - Mailing list pgsql-general

From JORGE MALDONADO
Subject Re: Backing up a DB excluding certain tables
Date
Msg-id CAAY=A7-waAUWfZtrvhpV+pykW2N-P9zLkOhxbPoQoXY_BXHXkA@mail.gmail.com
Whole thread Raw
In response to Re: Backing up a DB excluding certain tables  (Adrian Klaver <adrian.klaver@aklaver.com>)
Responses Re: Backing up a DB excluding certain tables
List 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.klaver@aklaver.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.klaver@aklaver.com

pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Displaying chat by punished users only to themselves (db fiddle attached)
Next
From: Alexander Farber
Date:
Subject: Re: Displaying chat by punished users only to themselves (db fiddle attached)