3

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?

Screenshot

\l output:

ProjectsManagement | postgres | UTF8 | Russian_Russia.1251 | Russian_Russia.1251 |

4

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.

3

if the table's name is not all lower-case, you need to double-quote it, and then single quote the whole schema.table as well, with either '"Statuses"' or 'public."Statuses"':

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

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

The above is for Linux/Unix systems. Windows command line has different behaviour regarding quoting and escaping special characters. So the following (or some of them) work but I'm not sure which is best and safest:

 -t "public.""Statuses"""           -- works
 -t "public.\"Statuses\""           -- works
 -t "public.^"Statuses^""           -- NO


 -t public."""Statuses"""           -- works
 -t public."\"Statuses\""           -- works
 -t public."^"Statuses^""           -- NO

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.