Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

postgres外部表

wnh5 edited this page Oct 21, 2017 · 16 revisions

#安装file_fdw

需要先安装file_fdw,一般是进到PostgreSQL的源码包中的contrib/file_fdw目录下,执行:

make

make install

然后进入数据库中,执行以下SQL把file_fdw安装上:

CREATE EXTENSION file_fdw;
CREATE SERVER file_fdw_server FOREIGN DATA WRAPPER file_fdw;
grant usage on foreign data wrapper file_fdw to liuche;
revoke usage on foreign data wrapper file_fdw from liuche;
CREATE FOREIGN TABLE test_table (
 id bigint,
 name Text,
)
SERVER file_fdw_server
OPTIONS (format 'csv', filename '/Users/liuche/tmp/test_table.txt', delimiter ',');

Clone this wiki locally

AltStyle によって変換されたページ (->オリジナル) /