一个database下的table可以分成三个部分,一部分是用户自己创建的,一般都会在模式的public下面,剩下两个部分则是pg_catalog和information_schema,就在目录下面。
如果要查找所有的table,可以使用select * from pg_tables查看
schemaname | tablename | tableowner | tablespace | hasindexes | hasrules | hastriggers--------------------+-------------------------+------------+------------+------------+----------+------------- public | author_base | jincheng | | f | f | f information_schema | sql_implementation_info | postgres | | f | f | fpg_catalog | pg_attribute | postgres | | t | f | fpg_catalog | pg_authID | postgres | pg_global | t | f | f
如果只需要查找用户自己创建的table,则只需要使用select * from pg_tables where tableowner = 'jincheng'
2、导入导出表数据使用copy命令将表数据导入到txt文件或从txt文件导入数据
copy tablename to 'filepath' with delimiter as '|';
copy tablename from 'filepath' with delimiter as '|';
使用pg_dump转储数据库
转储一个数据库∶pg_dump mydb > db.out重载这个数据库∶psql -d database -f db.out输出一个叫 mydb 的包含BLOB 的数据库到一个 tar 文件:pg_dump -Ft -b mydb > db.tar把这个数据库(连同BLOB) 一起恢复到一个现有的叫 newdb 的数据库:pg_restore -d newdb db.tar导出单张表pg_dump -t tablename dbname > db.out
附pg_dump参数一个PostgreSQL 7.3 文档-pg_dump
总结以上是内存溢出为你收集整理的[postgresql]postgresql *** 作记录全部内容,希望文章能够帮你解决[postgresql]postgresql *** 作记录所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)