Excluding schema from backup

Поиск
Список
Период
Сортировка
Искать

Excluding schema from backup

От:
Stéphane Schildknecht<stephane.schildknecht@postgresqlfr.org>
Дата:
Hi all,

I tried the knewly introduced feature allowing one to exclude a schema
from a backup with pg_dump, but I got a
really strange error :

pg_dump -U postgres MYDB -N "_MYDB" gives me a dump including that schema.

I then tried pg_dump -U postgres MYDB -n "_MYDB" and then got "pg_dump:
No matching schemas were found"

Dumping the only public schema works. But, by doing so, I miss some
other schema I really need.

Is there a limitation I didn't catch ?

Thanks by advance.

Stéphane Schildknecht

Re: Excluding schema from backup

От:
Bill Moran <wmoran@collaborativefusion.com>
Дата:
In response to "Stéphane Schildknecht" :

> Hi all,
> 
> I tried the knewly introduced feature allowing one to exclude a schema
> from a backup with pg_dump, but I got a
> really strange error :
> 
> pg_dump -U postgres MYDB -N "_MYDB" gives me a dump including that schema.
> 
> I then tried pg_dump -U postgres MYDB -n "_MYDB" and then got "pg_dump:
> No matching schemas were found"
> 
> Dumping the only public schema works. But, by doing so, I miss some
> other schema I really need.
> 
> Is there a limitation I didn't catch ?

My guess is that you're hitting case-folding issues.  Try:

pg_dump -U postgres MYDB -n \"_MYDB\"

-- 
Bill Moran
Collaborative Fusion Inc.

wmoran@collaborativefusion.com
Phone: 412-422-3463x4023

Re: Excluding schema from backup

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Bill Moran  writes:
> In response to "St�phane Schildknecht" :
>> pg_dump -U postgres MYDB -N "_MYDB" gives me a dump including that schema.
>> 
>> I then tried pg_dump -U postgres MYDB -n "_MYDB" and then got "pg_dump:
>> No matching schemas were found"

> My guess is that you're hitting case-folding issues.  Try:
> pg_dump -U postgres MYDB -n \"_MYDB\"

Yeah, see the last example in the 8.2 pg_dump reference page:

  To specify an upper-case or mixed-case name in -t and related
  switches, you need to double-quote the name; else it will be folded to
  lower case (see Patterns). But double quotes are special to the shell,
  so in turn they must be quoted. Thus, to dump a single table with a
  mixed-case name, you need something like

    $ pg_dump -t '"MixedCaseName"' mydb > mytab.sql

			regards, tom lane
FAQ