从逻辑上看,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之间关系的更多相关文章

  1. Android中sp和px之间关系探究

    记得当时在刚接触Android时都在说不要用px,要用sp,所以在实际工作当中当然就按照这个规则,所以都要将px换算成sp,而我在实际工作中的换算规则是dp=px * 1.5,而且用这种规则到现在基本 ...

  2. Excel Open Xml中CellStyleXfs,cellStyle,cellXfs之间关系的总结

    最近这几个东东打交道了几天,总算是弄明白了,综合多个帖子,现在总结如下: 在创建stylesheet时,必须创建fonts,Fills,Borders 和cellXfs(CellFormats)四个节 ...

  3. PostgreSQL模式(schema)介绍

    一个PostgreSQL数据库集群包含一个或多个已命名数据库.用户和用户组在整个集群范围内是共享的,但是其它数据并不共享.任何与服务器连接的客户都只能访问那个在连接请求里声明的数据库. 注意: 集群中 ...

  4. [原创]PostgreSQL中十进制、二进制、十六进制之间的相互转换

    在PostgreSQL中,二进制.十进制.十六进制之间的转换是非常方便的,如下: 十进制转十六进制和二进制 mydb=# SELECT to_hex(10); to_hex -------- a (1 ...

  5. Postgresql中临时表(temporary table)的特性和用法

    熟悉Oracle的人,相比对临时表(temporary table)并不陌生,很多场景对解决问题起到不错的作用,开源库Postgresql中,也有临时表的概念,虽然和Oracle中临时表名字相同,使用 ...

  6. PostgreSQL、SQL Server数据库中的数据类型的映射关系

    PostgreSQL 8.1 轰动发布,我也打算将原来使用 SQL Server 的一些应用迁移到 PostgreSQL 上,首先需要迁移的是表,那么这就必须要先搞清楚这两个数据库中的数据类型的映射关 ...

  7. talend openstudio 在OracleInput组件中guess Schema 出现Database connection is failed 的错误

    错误描述: talend openstudio 在OracleInput组件中guess Schema 出现Database connection is failed 的错误. 查看错误详情,发现错误 ...

  8. HBase入门实例: Table中Family和Qualifier的关系与区别

    Table中Family和Qualifier的关系与区别 就像用MySQL一样,我们要做的是表设计,MySQL中的表,行,列的在HBase已经有所区别了,在HBase中主要是Table和Family和 ...

  9. 数据库中的Schema是什么?

    在数据库中,schema(发音 “skee-muh” 或者“skee-mah”,中文叫模式)是数据库的组织和结构,schemas andschemata都可以作为复数形式.模式中包含了schema对象 ...

随机推荐

  1. LeetCode Reverse Linked List (反置链表)

    题意: 将单恋表反转. 思路: 两种方法:迭代和递归. 递归 /** * Definition for singly-linked list. * struct ListNode { * int va ...

  2. LeetCode: Single Number I && II

    I title: Given an array of integers, every element appears twice except for one. Find that single on ...

  3. RTP协议学习大总结从原理到代码

    from:http://wenku.baidu.com/view/aaad3d136edb6f1aff001fa5.html 一.流媒体概念 流媒体包含广义和狭义两种内涵:广义上的流媒体指的是使音频和 ...

  4. 《C++ Primer 4th》读书笔记 第4章-数组和指针

    原创文章,转载请注明出处: http://www.cnblogs.com/DayByDay/p/3911573.html

  5. delphi 当月的第一天, 当月的最后一天

    //取当月的第一天function TDealWithXML.FDOM(Date: TDateTime): TDateTime;var Year, Month, Day: Word;begin Dec ...

  6. hdu 1078(dfs记忆化搜索)

    题意:容易理解... 思路:我开始是用dfs剪枝做的,968ms险过的,后来在网上学习了记忆化搜索=深搜形式+dp思想,时间复杂度大大降低,我个人理解,就是从某一个点出发,前面的点是由后面的点求出的, ...

  7. Front-End-Develop-Guide

    这份文件包含一系列用于面试审查求职者(候选人)的前端面试问题.这并不推荐把每个问题都问在同一个求职者(因为这会花几个小时的时间).从列表中抽取一些问题能够帮助你审查你需要求职者具备的一些技能. 注: ...

  8. .net mvc HtmlHelper扩展使用

    如果是你是从webform开始接触.net,你应该记得webform开发中,存在自定义控件这东西,它使得我们开发起来十分方便,如今mvc大势所趋,其实在mvc开发时,也存在自定义控件这么个东西,那就是 ...

  9. [HIve - LanguageManual] Subqueries

    Subqueries in the FROM Clause Subqueries in the WHERE Clause Subqueries in the FROM Clause SELECT .. ...

  10. ubuntu开机自启动脚本编写

    1.将启动脚本复制到/etc/init.d目录下面 2.chmod 755 /etc/init.d/xxx 3.sudo update-rc.d /etc/init.d/xxx defaults 95 ...