Re: really novice with Postgres ! - Mailing list pgsql-novice

From raghu ram
Subject Re: really novice with Postgres !
Date
Msg-id CALnrrJROC5xpXvGEnP+0C7V9UDfXVE5xAstf2iQVzUVip4kSGQ@mail.gmail.com
Whole thread Raw
In response to really novice with Postgres !  (Jean MAURICE <mauricejea@numericable.fr>)
List pgsql-novice

On Fri, Aug 2, 2013 at 6:21 PM, Jean MAURICE <mauricejea@numericable.fr> wrote:
Hi everybody,

I have some more questions :
Is there a SQL command to
 - test if a database exists
postgres=# select * from pg_database where datname='<DB name>';

  or
postgres=# \l
 
 - test if a table exists

postgres=# select * from pg_class where rename='<tablename>';
 
 
 - get the list of the tables of a database

 postgres=# \dt

       or
postgres=# select * from pg_class

 - get the structure (list of fields) of a table

 
 postgres=# \d <tablename>

Thanks & Regards
Raghu Ram

pgsql-novice by date:

Previous
From: Tovo Rabemanantsoa
Date:
Subject: Re: really novice with Postgres !
Next
From: Jean MAURICE
Date:
Subject: Re: really novice with Postgres !