Re: \d output to a file

From: Geoffrey <esoteric(at)3times25(dot)net>
To: pgsqlnovice <pgsql-novice(at)postgresql(dot)org>, pgsqlperform <pgsql-performance(at)postgresql(dot)org>
Subject: Re: \d output to a file
Date: 2004-12-15 15:17:10
Message-ID: 41C05576.7030703@3times25.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice pgsql-performance

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

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Geoffrey 2004-12-15 15:23:54 Re: [despammed] \d output to a file
Previous Message Joe Conway 2004-12-15 15:16:20 Re: function returning a row

Browse pgsql-performance by date

  From Date Subject
Next Message Geoffrey 2004-12-15 15:23:54 Re: [despammed] \d output to a file
Previous Message Gary Cowell 2004-12-15 15:12:17 Re: [PERFORM] \d output to a file