postgresql 如何创建 postgres 数据库架构的 sql 脚本?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7804698/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to create sql script of postgres database schema?
提问by DMS
I want sql script of postgres 9 database schema which is not on local server. I tried pg_dump command on sql editor of pgAdmin and its not working there. I m not sure where to run that command. Please assist me with the same.... Thanks..
我想要不在本地服务器上的 postgres 9 数据库模式的 sql 脚本。我在 pgAdmin 的 sql 编辑器上尝试了 pg_dump 命令,但它在那里不起作用。我不确定在哪里运行该命令。请帮助我同样....谢谢..
回答by Bohemian
pg_dump
is a command line utility; it isn't SQL, so it won't work in pgAdmin or anywhere else that executes SQL.
pg_dump
是一个命令行实用程序;它不是 SQL,所以它不能在 pgAdmin 或其他任何执行 SQL 的地方工作。
pgAdmin
however does have a facility to do what you want:
pgAdmin
但是确实有能力做你想做的事:
- Right-click on the database you want to export
- Select
Backup
from the pop-up menu - Chose "format"
Plain
- Chose "plain option"
Only schema
- 右键单击要导出的数据库
- 选择
Backup
从弹出菜单 - 选择“格式”
Plain
- 选择“普通选项”
Only schema