Thread: database and table listing

database and table listing

From
steve@foxx.uklinux.net (Stephen Patterson)
Date:
are there any SQL statements which I can type into the psql client to give
a listing of available databases, available tables (within a database), and
to view the structure of a single table.


--
Kindness is a language which the deaf can hear and the blind can read.
        -- Mark Twain

--    --    --    --    --    --    --    --    --    --

Stephen Patterson    steve@foxx.UKL.net

(Replace UKL with uklinux to reply)

Re: database and table listing

From
Marko Kreen
Date:
On Wed, Nov 01, 2000 at 07:00:12PM +0000, Stephen Patterson wrote:
> are there any SQL statements which I can type into the psql client to give
> a listing of available databases, available tables (within a database), and
> to view the structure of a single table.

Start psql as 'psql -E' and then try psql internal commands
so you see what queries psql itself generates.

--
marko


Re: database and table listing

From
Richard Poole
Date:
On Wed, Nov 01, 2000 at 07:00:12PM +0000, Stephen Patterson wrote:
> are there any SQL statements which I can type into the psql client to give
> a listing of available databases,

\l

available tables (within a database),

\d

> and to view the structure of a single table.

\d tablename


All of which is in "man psql"...

These aren't SQL statements themselves, but if you start psql with
"-E", you can see the SQL queries which are sent to the backend when
you use them.

Richard

Re: database and table listing

From
Igor Roboul
Date:
On Wed, Nov 01, 2000 at 07:16:16PM +0000, Richard Poole wrote:
> All of which is in "man psql"...
Or just do \? at psql prompt :-) \h will give you PostgreSQL SQL statements.

--
Igor Roboul, Unix System Administrator & Programmer @ sanatorium "Raduga",
Sochi, Russia
http://www.brainbench.com/transcript.jsp?pid=304744