libvirtualpg  2.0.0


VirtualPG is an open source library implementing a Virtual Table extension to SQLite allowing to establish a connection to an external PostgreSQL/PostGIS Table or View.

Such a Virtual Table can then be handled using the usual SQLite's onw SQL dialect (SELECT / INSERT / UPDATE / DELETE), more or less exactly as if it was a native Table.

Building and installing VirtualPG is straightforward:

make install

Linking VirtualPG to your own code is usually simple:

gcc my_program.c -o my_program -lvirtualpg -lsqlite3 

On some systems you may have to provide a slightly more complex arrangement:

gcc -I/usr/local/include my_program.c -o my_program \
  -L/usr/local/lib -lvirtualpg -lsqlite3
VirtualPG obviously depends on libpq (the PostgreSQL own client library), but directly linking libpq (-lpq) isn't strictly required because VirtualPG can be initialized in such a way so to rely upon late binding instead of hard linking.
Please read the Tutorial for more detailed informations about this specific topic.

VirtualPG also provides pkg-config support, so you can also do:

gcc -I/usr/local/include my_program.c -o my_program `pkg-config --libs virtualpg`-lsqlite3

VirtualPG is licensed under the MPL tri-license terms: you are free to choose the best-fit license between:

  • the MPL 1.1
  • the GPL v2.0 or any subsequent version
  • the LGPL v2.1 or any subsequent version

Enjoy, and happy coding