Search code examples
postgresqlpostgres-fdw

FOREIGN DATA WRAPPER file_fdw not exist, how to install it?


FDW (Foreign Data Wrappers) are very useful, and I need them to read CSV files. (Please do not reply to say "use COPY"). Generally using it on other machines is "plug and play"... But on my Windows laptop I try the following commands and it fails:

postgres=# CREATE EXTENSION postgres_fdw;
CREATE EXTENSION

postgres=# CREATE SERVER fdw_files FOREIGN DATA WRAPPER file_fdw;
ERROR:  foreign-data wrapper "file_fdw" does not exist

It seems that I have all permissions to use the extension, but Google says nothing about error "file_fdw does not exist".

I am expectig that the standard the CREATE commands-sequence is acceptd, as in this example.


Notes

postgres=# \dew
                      List of foreign-data wrappers
     Name     |  Owner   |       Handler        |       Validator
--------------+----------+----------------------+------------------------
 postgres_fdw | postgres | postgres_fdw_handler | postgres_fdw_validator
(1 row)


postgres=# select version();
                          version
------------------------------------------------------------
 PostgreSQL 14.1, compiled by Visual C++ build 1914, 64-bit
(1 row)

These questions are similar but has no answer:


Solution

  • You created the wrong extension: if you want the file_fdw extension, you have to

    CREATE EXTENSION file_fdw;
    

    By the way: I don't think you should create the extension in the postgres database. Extensions, like most other objects, are local to the database, and the postgres database had best be left unused; it is designed to be used for administrative purposes.