Re: Moving from MySQL to PGSQL....some questions

From: Shridhar Daithankar <shridhar(at)frodo(dot)hserus(dot)net>
To: Karam Chand <karam_chand03(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Moving from MySQL to PGSQL....some questions
Date: 2004-02-25 15:14:26
Message-ID: 403CBBD2.9030708@frodo.hserus.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Karam Chand wrote:
> 1.) What is template1 and template0? I assume these
> are system databases. Am I right?

Yes. whenever a new database is created, these databases are copied there. So
these are like initial master copies.

> 2.) When I create a database using CREATE DATABASE
> stmt. a new DB is created where it has 4 schemas and
> around 100 tables. These are the system tables keeping
> information about everything in the database? I hope I
> am correct :)

Yes.

> 3.) To get all the database is the server we use query
> like -
>
> select datname from pg_database
>
> 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.
>
> Why I am saying so coz in PgAdmin III i can see these
> tables in all the databases?

Some tables such as users/passwords/groups and databases are shared across all
the databases. You are looking at same data.
>
> 4.) I couldnot find any query to change the context of
> database like in MySQL :
>
> use database;
>
> or am i missing something?

Any postgresql session has to connect to a database. To connect to different
database, you need to initiate a new connection or drop existing one and create
new one.

You can not switch the database-connected-to on the fly.

> 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?

No. Simplest would be issuing \? on psql prompt. It will tell you plethora of
options/commands using which you can accomplish many task. Just remember that
these are not SQL command provided by server. It is the psql application which
provide these commands. So you cannot use them in say php.

> Any help would be appreciated.

HTH

Shridhar

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message cnliou 2004-02-25 15:17:04 Re: invalid memory alloc request size
Previous Message Dave Cramer 2004-02-25 15:11:57 Re: Moving from MySQL to PGSQL....some questions