![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello I have been working with Access and MySQL for pretty long time. Very simple and able to perform their jobs. I dont need to start a flame anymore ![]() I have to work with PGSQL for my companies current project. I have been able to setup postgresql in my rh box and i can connect and work with psql. I even downloaded pgadmin III so that i can get to work with a GUI interface. As I starting...I see the architecture of PGSQL is quite complex...or thats what I feel....maybe its for good Here are some of my doubts :1.) What is template1 and template0? I assume these are system databases. Am I right? 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 ![]() 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? 4.) I couldnot find any query to change the context of database like in MySQL : use database; or am i missing something? 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? Any help would be appreciated. Regards Karam __________________________________ Do you Yahoo!? Yahoo! Mail SpamGuard - Read only the mail you want. http://antispam.yahoo.com/tools ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org -- |
#3
| ||||||
| ||||||
|
|
1.) What is template1 and template0? I assume these are system databases. Am I right? |
|
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 ![]() |
|
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? |
|
4.) I couldnot find any query to change the context of database like in MySQL : use database; or am i missing something? |
|
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? |
|
Any help would be appreciated. |
#4
| |||||
| |||||
|
|
1.) What is template1 and template0? I assume these are system databases. Am I right? |
|
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. |
|
4.) I couldnot find any query to change the context of database like in MySQL : use database; |
|
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? |
#5
| |||
| |||
|
|
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 |
#6
| |||
| |||
|
|
When I am accessing it using PgAdmin III on Windows I can only see the 'public' schema and its tables? Why is it so? |
#7
| |||
| |||
|
|
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. |
#8
| |||
| |||
|
|
4.) I couldnot find any query to change the context of database like in MySQL : use database; |
#9
| |||
| |||
|
|
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? 5.) In MySQL, there are many command like show tables, 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. If you run psql with the "-E" parameter, whenever you execute a psql |
|
Any help would be appreciated. Shachar |
#10
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |