postgres外部表
在創建外部表的時候遇見:
CREATE EXTENSION file_fdw;
2018-12-21 17:32:23.822 CST [31237] ERROR:? could not open extension control file "/usr/local/pgsql/share/extension/file_fdw.control": 沒有那個文件或目錄
2018-12-21 17:32:23.822 CST [31237] STATEMENT:? CREATE EXTENSION file_fdw;
ERROR:? could not open extension control file "/usr/local/pgsql/share/extension/file_fdw.control": 沒有那個文件或目錄
原因是,我們安裝postgres時,是沒有安裝file_fwd擴展的,需要手動安裝。
需要進去postgres的安裝目錄:/root/tmp/postgresql-10.5/contrib/file_fdw
然后:make?????????????? make install
安裝完成后,則可以順利通過:
postgres=#?? CREATE EXTENSION file_fdw;
CREATE EXTENSION
postgres=# CREATE SERVER file_fdw_server FOREIGN DATA WRAPPER file_fdw;
CREATE SERVER
創建外部表:
create foreign table test_03(id int,name text) server file_fdw_server options(format 'text',filename '/home/postgres/foreign_tables/test_03.txt',delimiter ',',null '');
在路徑下的文件顯示:
[postgres@master ~]$ more /home/postgres/foreign_tables/test_03.txt 1,zhang 2,wang 3,dong外部表查詢:
postgres=# select * from test_03;id | name ----+-------1 | zhang2 | wang3 | dong (3 rows)?
轉載于:https://www.cnblogs.com/hello-wei/p/10157362.html
總結
以上是生活随笔為你收集整理的postgres外部表的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 如何保存Tensorflow中的Tens
- 下一篇: BZOJ 3639: Query on