zoukankan      html  css  js  c++  java
  • 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 | zhang
      2 | wang
      3 | dong
    (3 rows)
  • 相关阅读:
    https://archive.ics.uci.edu/ml/datasets.php
    实战教程 :使用Python和keras进行文本分类(上)(重要)
    洛谷 P1073 最优贸易
    P2278 [HNOI2003]操作系统
    洛谷P2024 食物链
    模板
    我的博客
    mysql一条sql把表中的男改为女,女改为男
    树的度和结点数的关系
    Spider实例详解
  • 原文地址:https://www.cnblogs.com/hello-wei/p/10157362.html
Copyright © 2011-2022 走看看