PostgreSQL怎么导出表结构

2025年02月11日 postgresql Python51

PostgreSQL怎么导出表结构

pg_dump命令可以导出数据库中的表结构。

参数如下:

使用示例:

pg_dump -s -t tlb exampledb > /tmp/tlb

其中,exampledb是数据库,tlb是exampledb中的表,/tmp/tlb是定向到的文件.

如果数据库是远程的,需要指定主机,端口,用户等

pg_dump -h host  -p port -U username -s -t tablename dbname > struct.sql

推荐:postgresql教程

本文链接:http://so.lmcjl.com/news/22948/

展开阅读全文