HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMinor

Can't create a backup of data of a single table

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
cancreatesingledatatablebackup

Problem

I try to use a command:

pg_dump -U postgres -d "ProjectsManagement" -t public.Statuses -a > path


But 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:

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


You can read about it here.

Code Snippets

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

Context

StackExchange Database Administrators Q#158044, answer score: 5

Revisions (0)

No revisions yet.