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

Re: \d output to a file

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Geoffrey <esoteric(at)3times25(dot)net>
Cc: 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 16:50:58
Message-ID: 2441.1103129458@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novicepgsql-performance
Geoffrey <esoteric(at)3times25(dot)net> writes:
> sarlav kumar wrote:
>> I would like to write the output of the \d command on all tables in a
>> database to an output file.

> What is the OS?  On any UNIX variant you can do:
> echo '\d' | psql > outputfile

Or use \o:

regression=# \o zzz1
regression=# \d
regression=# \o
regression=# \d
             List of relations
 Schema |     Name      | Type  |  Owner
--------+---------------+-------+----------
 public | pg_ts_cfg     | table | postgres
 public | pg_ts_cfgmap  | table | postgres
 public | pg_ts_dict    | table | postgres
 public | pg_ts_parser  | table | postgres
 public | t_test        | table | postgres
 public | test_tsvector | table | postgres
(6 rows)

regression=# \q
$ cat zzz1
             List of relations
 Schema |     Name      | Type  |  Owner
--------+---------------+-------+----------
 public | pg_ts_cfg     | table | postgres
 public | pg_ts_cfgmap  | table | postgres
 public | pg_ts_dict    | table | postgres
 public | pg_ts_parser  | table | postgres
 public | t_test        | table | postgres
 public | test_tsvector | table | postgres
(6 rows)

$

			regards, tom lane

In response to

Responses

pgsql-novice by date

Next:From: Michael FuhrDate: 2004-12-15 17:05:37
Subject: Re: function returning a row
Previous:From: Kretschmer AndreasDate: 2004-12-15 16:21:57
Subject: Re: [despammed] \d output to a file

pgsql-performance by date

Next:From: Kretschmer AndreasDate: 2004-12-15 18:04:17
Subject: Re: \d output to a file
Previous:From: Kretschmer AndreasDate: 2004-12-15 16:21:57
Subject: Re: [despammed] \d output to a file

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