我知道下载可以使用的模式 pg_dump -U postgres -h localhost -d crm -h localhost -s > exp.dmp
.然而,这并没有提供有关外键的正确信息,哪些表引用了当前表。
但是当我使用 \d+ <table_name>
, 它显示了关于带有外键的数据库的所有信息,哪些表引用了当前表。
现在的问题是如何下载这个\d+ <table_name>
输出。我尝试使用 \d+ <table_name> > abc.dmp
,但不起作用。执行此操作的任何命令?
附言我在 Linux(Ubuntu 16.04)上工作
最佳答案
查看 psql 帮助(\?
):
\o [FILE] send all query results to file or |pipe
例子:
test=# \o a_table.txt
test=# \d+ a_table
test=# \q
$ more a_table.txt
附言。使用不带参数的 \o
将其关闭。
关于linux - PostgreSQL : download schema at the same time while showing using\d+ <table_name> command?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43017633/