Re: TR: Issue: --exclude-schema flag not working with pgrestore

Поиск
Список
Период
Сортировка
От Julien Rouhaud
Тема Re: TR: Issue: --exclude-schema flag not working with pgrestore
Дата
Msg-id 20230111094026.6jajog43mb42rwvv@jrouhaud
обсуждение исходный текст
Ответ на TR: Issue: --exclude-schema flag not working with pgrestore  (ROCHER Julien <julien.rocher@emeria.eu>)
Список pgsql-bugs
Hi,

On Wed, Jan 11, 2023 at 09:07:08AM +0000, ROCHER Julien wrote:
> 
> I don’t expect the --exclude-schema flag (-N) to restore chosen schema with
> pgrestore<https://docs.postgresql.fr/11/app-pgrestore.html> tool, but it
> actually tries to create the schema then its table.  I deliberately keep the
> same db name in the below example because this is actually what I’m trying to
> do (restore a dump from a similar db but excluding some already existing
> schemas on it), but I guess you don’t need to deal with this detail.  Did I
> misunderstand this command ?

You didn't, but made an error in how SQL object names work:

> ➜  ~ psql -U julien -W -p 5432 -d postgres  -c "create schema schemaA; create schema schemaB;"

this creates schemaa and schemab, not schemaA and schemaB.  If you want objects
to be case sensitive at the SQL level, you need to double quote identifiers,
like "schemaB".

> ➜  ~ pg_restore -p 5432 -W -d postgres --verbose  -N schemaB dump.sql

this on the other hand is a command line utility, and will use the given case
(and properly quote identifers at the SQL leve), so it means "schemaB" which
isn't found and thus not filtered.



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

Предыдущее
От: ROCHER Julien
Дата:
Сообщение: TR: Issue: --exclude-schema flag not working with pgrestore
Следующее
От: PG Bug reporting form
Дата:
Сообщение: BUG #17745: RETURNING after INSERT does not return the same structure of response