Re: Backing up a DB excluding certain tables

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Backing up a DB excluding certain tables
Дата
Msg-id 282742.1651016166@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Backing up a DB excluding certain tables  (JORGE MALDONADO <jorgemal1960@gmail.com>)
Ответы Re: Backing up a DB excluding certain tables  (JORGE MALDONADO <jorgemal1960@gmail.com>)
Список pgsql-general
[ please keep the list cc'd ]

JORGE MALDONADO <jorgemal1960@gmail.com> writes:
> As for the answer by *Tom Lane*, I am not restoring the DB but only getting
> the backup in plain format. I see that tables that contain "AspNet" in
> their name are part of the resulting dumped file. For example, the
> following is part of the resulting backup plain file:

> CREATE TABLE riopoderoso."AspNetRoleClaims" (
>     "Id" integer NOT NULL,
>     "RoleId" character varying(450) NOT NULL,
>     "ClaimType" text,
>     "ClaimValue" text
> );

Ah.  Now that you actually showed us what you're doing, there are
two problems:

1. "aspnet*.*" is trying to match a *schema* name starting with "aspnet",
not a *table* name.  What you want is more like "*.aspnet*", or possibly
"riopoderoso.aspnet*".  (You can't just write "aspnet*", because
riopoderoso isn't going to be in pg_dump's search path, and that pattern
would only match tables in the search path.)

2. You're not accounting for case.  Per the discussion of patterns
in the psql reference manual, to match an upper-case name you'd need
to spell it with the correct casing and then put double quotes around
it.

Actually there's a third problem, which is to get the shell to not strip
the double quotes from the pattern before handing it to pg_dump.

For me, a dump command like

pg_dump -n riopoderoso -T '*."AspNet"*' ...

does what you want.  However, I gather you're doing this on Windows,
and I'm not sure whether shell command quoting rules are the same there.
You might need something weird like backslashing the double quotes.

            regards, tom lane



В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Fresh eyeballs needed: input into error
Следующее
От: Sam Kidman
Дата:
Сообщение: errcodes.h and others not generated when compiling 13.6 on M1 Mac