Given the following Postgres container:
docker run -i -p 54350:5432 --name test_postgres -e POSTGRES_PASSWORD=password -e POSTGRES_DB=test -e POSTGRES_SCHEMA=dba postgres:11 "-clog_statement=all"
and the following init sql script:
CREATE SCHEMA IF NOT EXISTS dba;
CREATE TABLE dba.mytable (mytable_id SERIAL);
When running \dt
in psql
I get:
psql -U postgres -h localhost -p 54350 -d test
test=# \dt dba.mytable
List of relations
Schema | Name | Type | Owner
--------+---------------+-------+----------
dba | mytable | table | postgres
(1 row)
test=#
But when I attempt to run pg_dump
, I get the following:
pg_dump \
--username=postgres --host=localhost --port=54350 --dbname=test \
--schema-only \
--no-privileges \
--disable-triggers \
--no-publications \
--no-security-labels \
--no-subscriptions \
--no-synchronized-snapshots \
--quote-all-identifiers \
-t=dba.mytable > dump.sql
Password:
pg_dump: error: no matching tables were found
I also tried with -t='"dba.mytable"'
and -t="dba.mytable"
.
I also tried with -t=test.dba.mytable
, -t='"test.dba.mytable"'
and -t="test.dba.mytable"
, but then I get
pg_dump: error: cross-database references are not implemented: test.dba
If I add --schema=dba
I get:
pg_dump: error: no matching schemas were found
Can you help me fix my pg_dump command so as to allow me to dump the table dba.mytable
?
Thanks!