Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postgresql - pg_dump - no matching schemas were found

I'm trying to create a backup from PostgreSQL database, but getting the following error: pg_dump: No matching schemas were found

I'm logged in as root and running the command

pg_dump -f db.dump --format=plain --schema=existing_schema --username=userx --host=localhost databasename

  1. I logged in with userx to psql and tried \dt - this gave me information, that schema with name existing_schema is public.
  2. I checked \l to see that databasename is the database name.
  3. Password is correct, otherwise I could not access psql.
  4. Localhost is correct, checked from running processes. Tried the ip-address of the server also, but in this case pg_admin gave an error about the host address.

Output of \dl:

 
                  List of relations

Schema |                Name                 | Type  | Owner
--------+-------------------------------------+-------+-------
 public | existing_schema                    | table | userx
like image 576
stubgo Avatar asked Dec 01 '22 21:12

stubgo


2 Answers

You can try with back slash and double quote as metioned here.

sudo -u postgres pg_dump -v Database_Name -t "\"Table_Name\""
like image 108
ronnefeldt Avatar answered Dec 27 '22 09:12

ronnefeldt


The schema's name is public.

existing_schema is the name of a table in the schema public.

It's not clear from your pg_dump commandline what you want to do.

If you want to export all tables from the schema public you need to specify:

--schema=public

If you want to export only the table existing_schema then you need to specify:

--table=existing_schema
like image 23
a_horse_with_no_name Avatar answered Dec 27 '22 10:12

a_horse_with_no_name