摘要: 查看schema信息:[pgsql@localhost bin]$ ./psqlpsql (9.1.2)Type "help" for help.pgsql=# create schema gaosche;CREATE SCHEMApgsql=# select catalog_name,schema_name from information_schema.schemata ; catalog_name | schema_name --------------+-------------------- pgsql | pg_toast pgsql | ... 阅读全文
posted @ 2013-07-04 12:15 健哥的数据花园 阅读(2000) 评论(0) 推荐(0)
摘要: 从逻辑上看,schema,table,都是位于database之下。首先,在postgres数据库下建立表(相当于建立在public schema下):[pgsql@localhost bin]$ ./psql -d postgrespsql (9.1.2)Type "help" for help.postgres=# create table tab200(id integer);CREATE TABLEpostgres=# \q然后,再在tester数据库下建立表(相当于建立在public schema下):[pgsql@localhost bin]$ ./psql - 阅读全文
posted @ 2013-07-04 11:52 健哥的数据花园 阅读(17650) 评论(0) 推荐(0)
摘要: db1=# \xExpanded display is on.db1=# SELECT * FROM information_schema.tables WHERE table_name='tab100';-[ RECORD 1 ]----------------+-----------table_catalog | db1table_schema | publictable_name | tab100table_type | BASE TABLEself_re... 阅读全文
posted @ 2013-07-04 11:34 健哥的数据花园 阅读(2565) 评论(0) 推荐(0)
摘要: 开始:当前的tablesapce信息pgsql=# select * from pg_tablespace; spcname | spcowner | spclocation | spcacl | spcoptions ------------+----------+-----------------------+--------+------------ pg_default | 10 | | | pg_global | 10 | | ... 阅读全文
posted @ 2013-07-04 10:29 健哥的数据花园 阅读(4528) 评论(0) 推荐(1)
摘要: [pgsql@localhost bin]$ ./psql -d testerpsql (9.1.2)Type "help" for help.tester=# select current_database(); current_database ------------------ tester(1 row)tester=# http://www.postgresql.org/docs/7.3/static/functions-misc.html 阅读全文
posted @ 2013-07-04 09:50 健哥的数据花园 阅读(5840) 评论(0) 推荐(0)
摘要: [pgsql@localhost bin]$ ./psql -d postgrespsql (9.1.2)Type "help" for help.postgres=# \dNo relations found.postgres=# create table tab001(id integer);CREATE TABLEpostgres=# select pg_relation_filepath('tab001'); pg_relation_filepath ---------------------- base/12699/139312(1 row)pos 阅读全文
posted @ 2013-07-04 09:42 健哥的数据花园 阅读(1884) 评论(0) 推荐(0)
摘要: base目录,这是所有数据库目录的父目录。在base目录下第一层,每个目录就是一个数据库所对应的文件。那么如何知道哪个目录对应哪个数据呢?查询如下:先看数据库列表[pgsql@localhost bin]$ ./psqlpsql (9.1.2)Type "help" for help.pgsql=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+--------... 阅读全文
posted @ 2013-07-04 09:40 健哥的数据花园 阅读(11014) 评论(0) 推荐(0)