Re: querying for specs? - Mailing list pgsql-general

From Stephan Szabo
Subject Re: querying for specs?
Date
Msg-id 20011217221130.Q57302-100000@megazone23.bigpanda.com
Whole thread Raw
In response to querying for specs?  (mjbjr@beaudesign.com)
List pgsql-general
On Mon, 17 Dec 2001 mjbjr@beaudesign.com wrote:

> I'm new to sql and to postgres.  I've spent quite a bit of time trying to
> determine answers to the following questions, but have been unsuccessful.
>
> Say you work at a small company, and the person who was db admin dies
> suddenly.  How do you:

I'm going to assume you can still get into the server at all.

> 1) determine what db's postgres knows about?
If you mean database names,
select datname from pg_database;
should do what you want.

Since you would need to know a database to connect to before giving the
query I'd suggest "template1" because it's pretty much guaranteed to
exist.

> 2) how do you determine what tables exist, if any, in a given db?
Probably easiest to connect to the database with psql and use:
\d
(see \? for more things you can do from psql)

> 3) how do you determine the structure/specification (not the data) of a table?
Depending on what you want, you might be able to use \d <table>
from psql, but that doesn't give everything.  pg_dump -s -t <table> <db>
may be more what you're looking for.


pgsql-general by date:

Previous
From: S P Arif Sahari Wibowo
Date:
Subject: Operation on bit strings with different length
Next
From: Martijn van Oosterhout
Date:
Subject: Re: querying for specs?