Re: querying for specs?

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: querying for specs?
Дата
Msg-id 20011217221130.Q57302-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на querying for specs?  (mjbjr@beaudesign.com)
Список 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 по дате отправления:

Предыдущее
От: S P Arif Sahari Wibowo
Дата:
Сообщение: Operation on bit strings with different length
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: querying for specs?