pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Geoffrey <esoteric@3times25.net>
To: pgsqlnovice <pgsql-novice@postgresql.org>
To: pgsqlperform <pgsql-performance@postgresql.org>
Subject: Re: \d output to a file
Date: Wed, 15 Dec 2004 10:17:10 -0500
Message-ID: <41C05576.7030703@3times25.net> (raw)
In-Reply-To: <20041215143822.37534.qmail@web51304.mail.yahoo.com>
References: <20041215143822.37534.qmail@web51304.mail.yahoo.com>

sarlav kumar wrote:
> Hi All,
> 
> I would like to write the output of the \d command on all tables in a
> database to an output file. There are more than 200 tables in the
> database. I am aware of \o command to write the output to a file.
> But, it will be tough to do the \d for each table manually and write
> the output to a file. Is there a command/ way in which I can achieve
> this without having to do it for each table? Any help in this regard
> would be really appreciated.

What is the OS?  On any UNIX variant you can do:

echo '\d' | psql > outputfile

But this will get you the system tables as well I think.

Alternately you could do something like:

for table in $(<listoftables); do
	echo '\d' | psql
done > outputfile

-- 
Until later, Geoffrey



view thread (10+ messages)  latest in thread

Message-ID: <41C05576.7030703@3times25.net>
Permalink:  ../41C05576.7030703@3times25.net/
Also on:    postgresql.org/message-id/41C05576.7030703@3times25.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: esoteric@3times25.net, pgsql-novice@postgresql.org
  Subject: Re: \d output to a file
  In-Reply-To: <41C05576.7030703@3times25.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox