Re: Viewing Database Scheme

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Viewing Database Scheme
Date: 2006-01-28 20:20:26
Message-ID: Pine.LNX.4.63.0601281207270.14888@salmo.appl-ecosys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, 28 Jan 2006, Tom Lane wrote:

> Not sure why you say "of course" there. \d output is properly paginated
> for me, and I believe for most people. What platform are you on, and
> what do you have environment variable PAGER set to? Is the output of
> plain old SELECT commands paginated for you?

Tom,

Running Slackware-10.2 with 'less' as the pager.

Here's what I'm seeing:

contacts=# \d | less
\d: extra argument "less" ignored

I can, however, run '\dt' and have it page normally. But, I cannot write
that output to a file using redirection or the tee command:

contacts=# \dt > xrms.tables
No matching relations found.
\dt: extra argument "xrms.tables" ignored

and if I enter
contacts=# \dt | tee > xrms.tables

I see
...
public | user_preference_type_options | table | rshepard
public | users | table | rshepard
(57 rows)

\dt: extra argument "tee" ignored
\dt: extra argument ">" ignored
\dt: extra argument "xrms.tables" ignored

Now, quitting postgres and reinvoking psql does fix the scroll-too-far
problem. But, something's not quite correct here; to wit:

contacts=# pg_dump --schema-only > xrms.txt;
contacts-# ;
ERROR: syntax error at or near "pg_dump" at character 1
LINE 1: pg_dump

> There is not a single command; you use queries against the system catalogs
> for purposes like this. The "system catalogs" chapter of the manual gives
> the details, but you can get a leg up by looking at the queries psql uses
> for whatever form of \d seems closest to what you want. Start psql with -E
> option to make it echo the queries it's using.

I'll be sure to read that section. The \dt and \di commands show me what I
want, but I cannot redirect output to a file. What am I still missing,
please?

Thanks,

Rich
--
Richard B. Shepard, Ph.D. | Author of "Quantifying Environmental
Applied Ecosystem Services, Inc. (TM) | Impact Assessments Using Fuzzy Logic"
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2006-01-28 20:23:44 Re: Viewing Database Scheme
Previous Message Ben Trewern 2006-01-28 20:17:44 Re: Seeking a better PL/pgSQL editor-debugger