Re: How to take backup of a table on a different schema in PostgreSQL

From: Glyn Astill <glynastill(at)yahoo(dot)co(dot)uk>
To: "Geo P(dot)C(dot)" <pcgeopc(at)gmail(dot)com>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: How to take backup of a table on a different schema in PostgreSQL
Date: 2015-08-06 10:52:59
Message-ID: 530671698.62863.1438858379459.JavaMail.yahoo@mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

> From: Geo P.C. <pcgeopc(at)gmail(dot)com>
>To: pgsql-admin(at)postgresql(dot)org
>Sent: Thursday, 6 August 2015, 11:20
>Subject: [ADMIN] How to take backup of a table on a different schema in PostgreSQL
>
>
>
>Please let us know in PostgreSQL how we can take backup of a table on a different schema. We have db named "geopostgrest" and under Schema named "1" (Not inside Public Schema) we need to take backup of table "activity"
>Please see the following:
>postgres=# \c geopostgrest
You are now connected to database "geopostgrest" as user "postgres".
geopostgrest=# \dt
No relations found.
geopostgrest=# \dt 1. List of relations Schema | Name | Type | Owner
--------+---------------------------------+-------+---------- 1 | activity | table | postgres
>We tried the following command but its not working.
>pg_dump -U postgres -n1 -d geopostgrest -t activity -f activity_05-08-2015.sql pg_dump: No matching tables were found
>We are using PostgreSQL 9.4.4 and Ubuntu 14.04.2 LTS
>Can any one please help us on it
>Thanks
>

>

If you take a peek at the man pages you'll see some thing like:

"The -n and -N switches have no effect when -t is used, because tables selected by -t will be dumped regardless of those switches, and non-table objects will not be dumped."

Try something like:

pg_dump -U postgres -t 1.activity -d geopostgrest -f activity_05-08-2015.sql

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Geo P.C. 2015-08-06 11:32:24 Re: How to take backup of a table on a different schema in PostgreSQL
Previous Message James Sebastian 2015-08-06 10:44:14 Postgres 9.1 - getting a continous archiving database to accept connections taking too long