On Wed, 25 Feb 2004, Karam Chand wrote:
> 1.) What is template1 and template0? I assume these
> are system databases. Am I right?
When you create a new database what you get is a copy of template1.
template0 is alsmost not used. If you mess up template1 so you can't
create usable new databases one can use template0 to create a new
template1.
The system tables are a bit complexed and some are shared between all
databases.
> 3.) To get all the database is the server we use query
> like -
>
> select datname from pg_database
or \l in psql
> I means that there exists a table pg_database in all
> the database and all the pg_database table(s) are
> updated whenever a user issues CREATE DATABASE stmt.
yes, pg_database is a shared table.
> 4.) I couldnot find any query to change the context of
> database like in MySQL :
>
> use database;
\c in psql.
>
> 5.) In MySQL, there are many command like show tables,
> show databases etc. to get object details. I cant see
> anything similar in PGSQL. After searching the net i
> find that i have to execute certain queries to fetch
> those queries. Is this the only way?
\d and others.
\? is a useful command. Also the man page (man psql) can help.
--
/Dennis Björklund