推荐答案 Karam, 试试\?得到你问题的答案。 Dave 周三,2004-02-25 09:57,Karam Chand写道:Karam,try \? to get answers to your questions.DaveOn Wed, 2004-02-25 at 09:57, Karam Chand wrote:你好 很长一段时间以来,我一直在使用Access和MySQL。非常简单并且能够完成他们的工作。我不再需要启动火焰了:) 我必须与PGSQL一起为我的公司当前的项目工作。 我已经能够在我的rh框中设置postgresql并且我可以连接并使用psql。我甚至下载了 pgadmin III,以便我可以使用GUI 界面。 当我开始......我看到PGSQL的架构是非常复杂......或者那就是我的感觉....也许它的好用:)以下是我的一些疑问: 1.)什么是template1和template0?我假设这些是系统数据库。我是对的吗? 2.)当我使用CREATE DATABASE stmt创建数据库时。创建一个新的DB,它有4个模式和大约100个表。系统表是否保存有关数据库中所有内容的信息?我希望我是正确的:) 3.)获取所有数据库是我们使用的服务器查询 从中选择datname pg_database 我的意思是在所有数据库中都存在一个表pg_database,并且只要用户发出CREATE DATABASE stmt,就会更新所有pg_database表。 为什么我在PgAdmin III中这么说,我可以在所有数据库中看到这些表? 4.)我找不到任何查询来改变 使用数据库; 或者我错过了什么? 5.)在MySQL中,有很多命令如show tables,显示数据库等以获取对象详细信息。我无法在PGSQL中看到类似的东西。搜索网后我发现我必须执行某些查询才能获取这些查询。这是唯一的方法吗? 任何帮助都会受到赞赏。 问候 Karam __________________________________ 你是雅虎吗? !?雅虎! Mail SpamGuard - 只读您想要的邮件。 http://antispam.yahoo。 com / tools ---------------------------(播出结束)--- ------------------------ 提示6:您是否搜索了我们的列表档案? http://archives.postgresql.org - Dave Cramer 519 939 0336 ICQ#14675561 ----------- ----------------(广播结束)--------------------------- 提示3:如果通过Usenet发布/阅读,请发送适当的 subscribe-nomail命令到 ma ******* @ postgresql.org 这样你的 消息可以干净利落地进入邮件列表--Dave Cramer519 939 0336ICQ # 14675561---------------------------(end of broadcast)---------------------------TIP 3: if posting/reading through Usenet, please send an appropriatesubscribe-nomail command to ma*******@postgresql.org so that yourmessage can get through to the mailing list cleanly Karam Chand写道:Karam Chand wrote: 1.)什么是template1和template0?我假设这些是系统数据库。我对吗? 是的。无论何时创建新数据库,都会在那里复制这些数据库。所以 这些就像初始主副本一样。 2.)当我使用CREATE DATABASE stmt创建数据库时。创建一个新的DB,它有4个模式和大约100个表。系统表是否保存有关数据库中所有内容的信息?我希望我是正确的:) 是的。 3.)获取所有数据库是我们使用的服务器查询喜欢 - 从pg_database中选择datname 我的意思是在所有数据库中都存在一个表pg_database,并且所有的pg_database表都是 为什么我在PgAdmin III中这么说,我可以在所有数据库中看到这些表? 一些表,例如用户/密码/组和数据库,在数据库的所有数据库中共享。您正在查看相同的数据。 4.)我找不到任何查询来改变数据库的上下文,如MySQL: 使用数据库; 任何postgresql会话都必须连接到数据库。要连接到不同的 数据库,您需要启动一个新连接或删除现有连接并创建 新数据。 您无法动态切换数据库连接。 5.)在MySQL中,有许多命令,如show table, show databases等,以获取对象详细信息。我无法在PGSQL中看到类似的东西。搜索网后我发现我必须执行某些查询才能获取这些查询。这是唯一的方法吗? 否。最简单的是发行\?在psql提示符下。它会告诉你过多的 选项/命令,使用它们可以完成许多任务。请记住 这些不是服务器提供的SQL命令。这是psql应用程序,它提供了这些命令。所以你不能在php中使用它们。 任何帮助都将不胜感激。 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. Sothese 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 allthe 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 differentdatabase, you need to initiate a new connection or drop existing one and createnew 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 ofoptions/commands using which you can accomplish many task. Just remember thatthese are not SQL command provided by server. It is the psql application whichprovide these commands. So you cannot use them in say php. Any help would be appreciated. HTH Shridhar ---------------------------(播出结束)--- ------------------------ 提示1:订阅和取消订阅命令转到 ma ******* @ postgresql.orgHTHShridhar---------------------------(end of broadcast)---------------------------TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org周三, 2004年2月25日,Karam Chand写道:On Wed, 25 Feb 2004, Karam Chand wrote: 1.)什么是template1和template0?我假设这些是系统数据库。我对吗? 创建新数据库时,你得到的是template1的副本。 template0几乎没有使用过。如果你搞乱了template1所以你不能创建可用的新数据库,可以使用template0来创建一个新的 模板。 系统表有点复杂,有些在所有 数据库之间共享。 3.)要获取所有数据库,我们使用的服务器是查询喜欢 - 从pg_database中选择datname 在psql中或\l 我的意思是存在一个表pg_database在所有数据库和所有pg_database表中,只要用户发出CREATE DATABASE stmt,就会更新这些表。 是的,pg_database是一个共享表。 4.)我找不到任何查询来改变数据库的上下文,就像在MySQL中一样: 使用数据库;在psql中 \ c。 5.)在MySQL中,有许多命令,如show table, show databases等,以获取对象详细信息。我无法在PGSQL中看到类似的东西。搜索网后我发现我必须执行某些查询才能获取这些查询。这是唯一的方法吗? 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''tcreate usable new databases one can use template0 to create a newtemplate1.The system tables are a bit complexed and some are shared between alldatabases. 3.) To get all the database is the server we use query like - select datname from pg_databaseor \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和其他人。 \?是一个有用的命令。手册页(man psql)也可以提供帮助。 - / Dennis Bj?rklund ---- -----------------------(播出结束)---------------------- ----- 提示7:别忘了增加免费空间地图设置\d and others.\? is a useful command. Also the man page (man psql) can help.--/Dennis Bj?rklund---------------------------(end of broadcast)---------------------------TIP 7: don''t forget to increase your free space map settings 这篇关于从MySQL迁移到PGSQL ....一些问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-20 18:22