snippetsqlMinor
Can't create a backup of data of a single table
Viewed 0 times
cancreatesingledatatablebackup
Problem
I try to use a command:
But it doesn't work and outputs:
pg_dump: соответствующие таблицы не найдены (English: Tables not found)
But this table exists and without a
What is happening?
ProjectsManagement | postgres | UTF8 | Russian_Russia.1251 |
Russian_Russia.1251 |
pg_dump -U postgres -d "ProjectsManagement" -t public.Statuses -a > pathBut it doesn't work and outputs:
pg_dump: соответствующие таблицы не найдены (English: Tables not found)
But this table exists and without a
-t argument it works.What is happening?
\l output:ProjectsManagement | postgres | UTF8 | Russian_Russia.1251 |
Russian_Russia.1251 |
Solution
Just taking a look at postgres documentation and samples I've found this specific case:
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:
You can read about it here.
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.sqlYou can read about it here.
Code Snippets
$ pg_dump -t "\"MixedCaseName\"" mydb > mytab.sqlContext
StackExchange Database Administrators Q#158044, answer score: 5
Revisions (0)
No revisions yet.