[英]How do I copy the table structure of a postgres table into a different postgres database without the data
[英]Importing existing table data to a new table in different database (postgres)
我想將一個數據庫的現有表的所有數據導入到 postgres 中不同數據庫中存在的新表中,任何建議都會有所幫助。
最簡單的方法是在目標數據庫中pg_dump
表和pg_restore
。
如果它不是一個選項,你絕對應該看看postgres_fdw
(Foreign Data Wrapper),它允許你訪問來自不同數據庫的數據——甚至來自不同的機器。 它比傳統的導出/導入方法稍微復雜一些,但它創建了到外部表的直接連接。
看看這個example
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.