“Lua is an efficient and easy to learn scripting language that has been designed to be be embedded into other software. It is being used as an extension language in many commercial and open source products. Lua programs are internally compiled to a bytecode which is then executed by a very fast “virtual machine”. Lua offers a very easy to use interface to software written in C, which allows the creation of extension modules, or bindings to other pieces of software, using the C language.
The core of our products is written in C and PostgreSQL is the database of choice. Most extensions to the software, and more recently complete applications, are written in the Lua language. These extensions or applications access internal state of the C core using Lua bindings. While we used Lua to access PostgreSQL since many years already, the Lua interface to PostgreSQL was relatively simple and offered only a subset of libpq’s functionality. In preparation of a talk for PGConf.EU 2012, I decided some time ago to make the Lua PostgreSQL binding functionally equivalent to libpq. The old interface lacked a lot of support functions, asynchronous connection and command execution, support for asynchronous notifications etc…”