PostgreSQL中,database,schema,table之间关系
从逻辑上看,schema,table,都是位于database之下。
首先,在postgres数据库下建立表(相当于建立在public schema下):
[pgsql@localhost bin]$ ./psql -d postgres
psql (9.1.2)
Type "help" for help. postgres=# create table tab200(id integer);
CREATE TABLE
postgres=# \q
然后,再在tester数据库下建立表(相当于建立在public schema下):
[pgsql@localhost bin]$ ./psql -d tester
psql (9.1.2)
Type "help" for help. tester=# create table tab200(id integer);
CREATE TABLE
tester=# \q
然后,再在其他的数据库下进行查看:
[pgsql@localhost bin]$ ./psql
psql (9.1.2)
Type "help" for help. pgsql=# SELECT * FROM information_schema.tables WHERE table_name='tab200';
table_catalog | table_schema | table_name | table_type | self_referencing_column_name | reference_generation | user_de
fined_type_catalog | user_defined_type_schema | user_defined_type_name | is_insertable_into | is_typed | commit_action
---------------+--------------+------------+------------+------------------------------+----------------------+--------
-------------------+--------------------------+------------------------+--------------------+----------+---------------
(0 rows) pgsql=# \q
然后,再在 postgres数据库和tester数据库下分别查看:
[pgsql@localhost bin]$ ./psql -d tester
psql (9.1.2)
Type "help" for help. tester=# SELECT * FROM information_schema.tables WHERE table_name='tab200';
table_catalog | table_schema | table_name | table_type | self_referencing_column_name | reference_generation | user_de
fined_type_catalog | user_defined_type_schema | user_defined_type_name | is_insertable_into | is_typed | commit_action
---------------+--------------+------------+------------+------------------------------+----------------------+--------
-------------------+--------------------------+------------------------+--------------------+----------+---------------
tester | public | tab200 | BASE TABLE | | |
| | | YES | NO |
(1 row) tester=# \q
[pgsql@localhost bin]$ ./psql -d postgres
psql (9.1.2)
Type "help" for help. postgres=# SELECT * FROM information_schema.tables WHERE table_name='tab200';
table_catalog | table_schema | table_name | table_type | self_referencing_column_name | reference_generation | user_de
fined_type_catalog | user_defined_type_schema | user_defined_type_name | is_insertable_into | is_typed | commit_action
---------------+--------------+------------+------------+------------------------------+----------------------+--------
-------------------+--------------------------+------------------------+--------------------+----------+---------------
postgres | public | tab200 | BASE TABLE | | |
| | | YES | NO |
(1 row)
PostgreSQL中,database,schema,table之间关系的更多相关文章
- Android中sp和px之间关系探究
记得当时在刚接触Android时都在说不要用px,要用sp,所以在实际工作当中当然就按照这个规则,所以都要将px换算成sp,而我在实际工作中的换算规则是dp=px * 1.5,而且用这种规则到现在基本 ...
- Excel Open Xml中CellStyleXfs,cellStyle,cellXfs之间关系的总结
最近这几个东东打交道了几天,总算是弄明白了,综合多个帖子,现在总结如下: 在创建stylesheet时,必须创建fonts,Fills,Borders 和cellXfs(CellFormats)四个节 ...
- PostgreSQL模式(schema)介绍
一个PostgreSQL数据库集群包含一个或多个已命名数据库.用户和用户组在整个集群范围内是共享的,但是其它数据并不共享.任何与服务器连接的客户都只能访问那个在连接请求里声明的数据库. 注意: 集群中 ...
- [原创]PostgreSQL中十进制、二进制、十六进制之间的相互转换
在PostgreSQL中,二进制.十进制.十六进制之间的转换是非常方便的,如下: 十进制转十六进制和二进制 mydb=# SELECT to_hex(10); to_hex -------- a (1 ...
- Postgresql中临时表(temporary table)的特性和用法
熟悉Oracle的人,相比对临时表(temporary table)并不陌生,很多场景对解决问题起到不错的作用,开源库Postgresql中,也有临时表的概念,虽然和Oracle中临时表名字相同,使用 ...
- PostgreSQL、SQL Server数据库中的数据类型的映射关系
PostgreSQL 8.1 轰动发布,我也打算将原来使用 SQL Server 的一些应用迁移到 PostgreSQL 上,首先需要迁移的是表,那么这就必须要先搞清楚这两个数据库中的数据类型的映射关 ...
- talend openstudio 在OracleInput组件中guess Schema 出现Database connection is failed 的错误
错误描述: talend openstudio 在OracleInput组件中guess Schema 出现Database connection is failed 的错误. 查看错误详情,发现错误 ...
- HBase入门实例: Table中Family和Qualifier的关系与区别
Table中Family和Qualifier的关系与区别 就像用MySQL一样,我们要做的是表设计,MySQL中的表,行,列的在HBase已经有所区别了,在HBase中主要是Table和Family和 ...
- 数据库中的Schema是什么?
在数据库中,schema(发音 “skee-muh” 或者“skee-mah”,中文叫模式)是数据库的组织和结构,schemas andschemata都可以作为复数形式.模式中包含了schema对象 ...
随机推荐
- noip2003提高组题解
这一年的前三题虽然难度不高,但是第二题极为繁琐,想在考场上用较短的时间拿到第二题的分数难上加难.所以必须要调整策略,争取拿其他三题的分数.第四题是比较普通的搜索题,分数比较好拿,但是很容易想成树形DP ...
- 图文详解YUV420数据格式
YUV格式有两大类:planar和packed.对于planar的YUV格式,先连续存储所有像素点的Y,紧接着存储所有像素点的U,随后是所有像素点的V.对于packed的YUV格式,每个像素点的Y,U ...
- ubuntu12.04上搭建darwin streaming server6.03
个人建议:使用DarwinStreamingSrvr5.5.5,因为DarwinStreamingSrvr6.0.3安装过程中有很多问题需要解决!而且安装只需执行./Install就可以! 1:下载d ...
- 【转】cocos2d-x Lua
Call custom c++ from Lua cocos2d-x lua binds c++ class, class functions ,enum and some global functi ...
- w3c盒子模型与ie盒子模型
盒子模型是css的专有名词,用来描述页面设置中的各种属性,如内容(content).填充(padding).边框(border).边界(margin),由于这些属性拼在一起,与日常生活中的“盒子”很相 ...
- Solr与Mysql简单集成
Solr与Mysql数据库的集成,实现全量索引.增量索引的创建. 基本原理很简单:在Solr项目中注册solr的DataImportHandler并配置Mysql数据源以及数据查询sql语句.当我们通 ...
- python 去掉\n\t多余空格
>>> import re >>> sss = "SELECT a.id,\n a.customer_id as user_id,\n ...
- Dev gridControl 添加表标题
1.OptionsView ->ShowViewCaption = True 2.ViewCaption = "标题"
- List转换成Json、对象集合转换Json等
#region List转换成Json /// <summary> /// List转换成Json /// </summary> public static string Li ...
- Asp.net TextBox常规输入验证
Asp.net TextBox只能输入数字<asp:textbox id="TextBox1" onkeyup="if(isNaN(value))execComma ...