如何为pgAdmin III中的多个表生成CREATE脚本? [英] How to generate a CREATE script for several tables in pgAdmin III?

查看:212
本文介绍了如何为pgAdmin III中的多个表生成CREATE脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在pgAdmin III中,您可以:

  • 右键单击表格;
  • 脚本;
  • 创建脚本;
  • 从"SQL编辑器"中保存脚本.

如果必须对一个以上的表执行此操作,是否有办法将脚本合并到一个文件中(除了手动复制粘贴外)?如果可以通过psql提示符或phppgadmin完成此操作,也可以.

解决方案

这是使用pgAdmin的一种方法.

  • 右键单击您的数据库(或架构).
  • 选择备份"
  • 在格式"下选择普通"
  • 在转储选项#1"下,选择仅架构"
  • 在对象"下选择所需的表.

然后单击备份".输出应该是带有创建表语句的纯文本文件.

此处是有关备份的PgAdmin文档.

In pgAdmin III you can:

  • right-click a table;
  • scripts;
  • CREATE script;
  • save the script from the SQL Editor.

If one has to do this for more than one table, is there a way to combine the scripts in one file (apart from manually copy-pasting them)? If this can be done via psql prompt or phppgadmin, that will be ok too.

解决方案

Here's a way using pgAdmin.

  • Right-click on your database (or schema).
  • Choose "backup"
  • Under "Format" choose "plain"
  • Under "Dump Options #1" choose "Only schema"
  • Under "Objects" choose the tables you want.

Then click "backup". The output should be a plain text file with the create table statements.

Here's the PgAdmin documentation on backup.

这篇关于如何为pgAdmin III中的多个表生成CREATE脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆