Download Latest Version Installer-Windows-7-EasyDeployExtensionsPack-32-64-(sqlite_fdw,www_fdw,mysql_fdw,ldap_fdw,couchdb_fdw,oracle_fdw).7z (11.2 MB)
Email in envelope

Get an email when there's a new version of postgresql-mingw-w64

Name Modified Size InfoDownloads / Week
Parent folder
src 2013-12-04
sql 2013-12-04
doc 2013-12-04
THANKS.md 2013-12-04 247 Bytes
sqlite_fdw.dll 2013-12-04 263.0 kB
sqlite_fdw.control 2013-12-04 137 Bytes
README.md 2013-12-04 1.0 kB
Makefile 2013-12-04 1.6 kB
License 2013-12-04 1.1 kB
Totals: 9 Items   267.0 kB 0

sqlite_fdw

Foreign Data Wrapper for sqlite

Compilation

To use this FDW, you first need to compile it. You'll need pg_config and the usual build toolset. Then just launch:

make
make install

And you're good to go.

Adding the extension

Connect to your database, and execute this query:

CREATE EXTENSION sqlite_fdw;

Using it

You first need to add a server. It will have an option, the sqlite file path. It must be readable by the postgres process.

CREATE SERVER sqlite_server
  FOREIGN DATA WRAPPER sqlite_fdw
  OPTIONS (database '/var/lib/pgsql/test.db');

Then you can create your foreign table. It will have one option, the table name on the sqlite database:

CREATE FOREIGN TABLE local_t1(... columns ...)
  SERVER sqlite_server
  OPTIONS (table 'remote_table');

Now, to get the contents of the remote table, you just need to execute a SELECT query on it:

SELECT * FROM local_t1;
Source: README.md, updated 2013-12-04