Name | Modified | Size | Downloads / Week |
---|---|---|---|
Parent folder | |||
python | 2013-12-07 | ||
Totals: 1 Item | 0 |
NEW !
Support for two additional extensions (mysql_fdw and ldap_fdw) have been added to the project. (See This Wiki Page for HOWTO compile them)
Procedure for compiling PosgreSQL-9.3.1 + "sqlite_fdw" + "www_fdw":
(Using mingw-w64 - (cross-compiling => i686) / gcc 4.8.0)
Note 1:
In the following "/usr/local/" corresponds to "C:\mingw32\msys\local\", because I installed MSYS in the root directory of mingw "C:\mingw32" ...
Note 2:
amp;gt; Install log: www_fdw.dll -> /usr/local/pgsql/lib www_fdw.control -> /usr/local/pgsql/share/extension sql/www_fdw--0.1.6.sql -> /usr/local/pgsql/share/extensionTesting the extensions (Windows Prompt):
1. Add "C:\mingw32\msys\local\pgsql\bin" and "C:\mingw32\msys\local\pgsql\lib" to $PATH 2. Add "C:\mingw32\msys\local\bin" to $PATH (accessing "libsqlite3-0.dll", "sqlite3.exe") 3. Add "C:\mingw32\msys\bin" to $PATH (accessing "msys-iconv-2.dll", "msys-1.0.dll")
4. Initialize the "data" (database) directory for the server:
* cd C:\mingw32\msys\local\pgsql\
* bin\initdb -Ddata
5. Start the PostgreSQL server:
* bin\postgres -Ddata
6. Create the superuser and role "postgres" (asking for password)
* bin\createuser -s -r -W postgres
7.1. Creating and testing the sqlite_fdw extension (depends on sqlite3.dll):
* CREATE EXTENSION sqlite_fdw;
* cd D:\postgresql-test-extensions
* Create a sqlite database (file "test.db")
[or use the one I provide]
- cd /usr/local/bin
- sqlite3 "test.db"
SQLite version 3.8.1 2013-10-17 12:57:35
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table tbl1(one varchar(10), two smallint);
sqlite> insert into tbl1 values('hello!',10);
sqlite> insert into tbl1 values('goodbye', 20);
sqlite> select * from tbl1;
hello!|10
goodbye|20
sqlite>
* Into the "postgres" database, create the sqlite server:
CREATE SERVER sqlite_server
FOREIGN DATA WRAPPER sqlite_fdw
OPTIONS (database 'D:\postgresql-test-extxtensions\test.db'); /* adapt to your config. */
* Mapping between "tbl1" (sqlite DB) and the new "local_tbl1"
CREATE FOREIGN TABLE local_tbl1(one varchar(10), two smallint)
SERVER sqlite_server
OPTIONS (table 'tbl1');
* Executing a request:
SELECT * from local_tbl1;
7.2. Creating and testing the extension www_fdw (depends on iconv.dll and libxml2.dll)
* CREATE EXTENSION www_fdw;
* Create a server (example with a "google search" one...):
[Example grabbed from: https://github.com/cyga/www_fdw/wiki/Examples]
CREATE SERVER www_fdw_google_search_server FOREIGN DATA WRAPPER www_fdw
OPTIONS (
uri 'https://ajax.googleapis.com/ajax/services/search/web?v=1.0',
cainfo 'C:\mingw32\msys\local\share\curl\curl-ca-bundle.crt'
);
/* Adapt "cainfo" option to your config. The path MUST be written the Windows way */
CREATE USER MAPPING FOR current_user SERVER www_fdw_google_search_server;
CREATE FOREIGN TABLE www_fdw_google_search (
title text,
link text,
snippet text,
q text /* used for easy query specifying */
) SERVER www_fdw_google_search_server;
Note: "curl --with-ssl" (the default) requiring a certificate,
----- this example only works if we specify the "cainfo" option
(".crt" certificate file)
* Request:
SELECT title,snippet FROM www_fdw_google_search WHERE q='cat dog' LIMIT 3;
PATH environment variable:
C:\mingw32\bin;
C:\mingw32\lib;
C:\mingw32\msys\local\pgsql\bin;
C:\mingw32\msys\local\pgsql\lib;
C:\mingw32\msys\local\bin;
C:\mingw32\msys\bin;
C:\mingw32\msys\local\ssl\bin;
C:\mingw32\i686-w64-mingw32\bin;
C:\mingw32\i686-w64-mingw32\lib;
C:\mingw32\opt\bin;
=>
SET PATH=%PATH%;C:\mingw32\bin;C:\mingw32\lib;C:\mingw32\i686-w64-mingw32\bin;C:\mingw32\msys\local\pgsql\bin;C:\mingw32\msys\local\pgsql\lib;C:\mingw32\msys\local\bin;C:\mingw32\msys\bin;C:\mingw32\msys\local\ssl\bin;C:\mingw32\i686-w64-mingw32\lib;C:\mingw32\opt\bin;
OR, using MSYS:
export PATH=$PATH:$MGWDIR"bin":$MGWDIR"lib":$MGWDIR$ARCH"/bin:/usr/local/pgsql/bin":/usr/msys/local/pgsql/lib:/usr/local/bin:/usr/bin:/usr/local/ssl/bin:$MGWDIR$ARCH"/lib":$MGWDIR"opt/bin"
TODO: create a ".sh" script that builds the standalone version from the mingw-32/64's install directory. (Identical script for both 32 and 64-bit versions using the environment variables: $ARCH, $SRCDIR and $MGWDIR)