X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3BED63B4A42; Wed, 15 Dec 2004 16:51:11 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 08467-05; Wed, 15 Dec 2004 16:51:06 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 76F5A3B49EE; Wed, 15 Dec 2004 16:51:05 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iBFGoweC002442; Wed, 15 Dec 2004 11:50:59 -0500 (EST) To: Geoffrey Cc: pgsqlnovice , pgsqlperform Subject: Re: \d output to a file In-reply-to: <41C05576.7030703@3times25.net> References: <20041215143822.37534.qmail@web51304.mail.yahoo.com> <41C05576.7030703@3times25.net> Comments: In-reply-to Geoffrey message dated "Wed, 15 Dec 2004 10:17:10 -0500" Date: Wed, 15 Dec 2004 11:50:58 -0500 Message-ID: <2441.1103129458@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200412/111 X-Sequence-Number: 11688 Geoffrey 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