Skip site navigation (1) Skip section navigation (2)

Re: pg_dump excluding tables content but not table schema

From: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: pg_dump excluding tables content but not table schema
Date: 2009-12-28 20:20:17
Message-ID: 20091228212017.77065fe3@dawn.webthatworks.it (view raw or flat)
Thread:
Lists: pgsql-general
On Mon, 28 Dec 2009 19:39:36 +0000
Raymond O'Donnell <rod(at)iol(dot)ie> wrote:

> On 28/12/2009 18:41, Ivan Sergio Borgonovo wrote:
> 
> > I'd like to just dump the table schema without dumping the table
> > contend.

> pg_dump -s -t <table name> <db name>

My fault. I was not clear enough.
I'd like to make a "mostly" full backup, excluding from backup just
the data of some tables but backing up the schema of those tables.

mmm let me try if

pg_dump -Fc -Z9 -s -t *.cache* -d mydb > schema_only.bak
pg_dump -Fc -Z9 -T *.cache* -d mydb > nearly_full.bak

cat nearly_full.bak schema_only.bak | pg_restore -1 -d mydb

It seems it is working... I'll test if everything is there.

-- 
Ivan Sergio Borgonovo
http://www.webthatworks.it


In response to

Responses

pgsql-general by date

Next:From: Raymond O'DonnellDate: 2009-12-28 20:27:32
Subject: Re: pg_dump excluding tables content but not table schema
Previous:From: GreenhornDate: 2009-12-28 20:13:46
Subject: Re: cross-database time extract?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group