Plugin Directory

Test out the new Plugin Directory and let us know what you think.
!This plugin hasn’t been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

PostgreSQL for WordPress (PG4WP)

PostgreSQL for WordPress is a special 'plugin' enabling WordPress to be used with a PostgreSQL database.



  • Some cleanup in old code that is not needed anymore
  • Enhanced wordpress-importer compatibility
  • Optimizations in wpsql_insert_id()


  • Added support for PostgreSQL 9.1+ (doesn't break compatibility with older versions)
  • Added support for specifying port in the server host (eg 'localhost:3128') (Patch from convict)
  • Added a handle for converting CAST(... AS CHAR) to CAST(... AS TEXT) (Problem pointed out by Aart Jan)
  • Added a filter to remove 'IF NOT EXISTS' for 'CREATE TABLE' queries
  • Enhancements for WPMU support


  • Corrected SQL_CALC_FOUND_ROWS handling, was broken by the latest code reorganisation


  • Corrected 'ON DUPLICATE KEY ...' handling (was not working at all)
  • Modified SQL_CALC_FOUND_ROWS handling for correct paging
  • Some conversion handling for WPMU to install correctly (WPMU not working yet though)
  • Improved installation/upgrade handling code (better detection of indexes, ADD COLUMN support, ...)


  • Error logging is disabled in the distribution
  • Added a handle for correct counting of users and roles
  • Added MONTH and YEAR to the 'INTERVAL...' handling code
  • Removed all ZdMultilang support hacks


  • Disabled all ZdMultilang support hacks
  • Fixed regressions that caused some WordPress features to not work properly
  • Rewrote database connection handling so WordPress installation can tell you when your username and password are wrong
  • Support for using an empty password for database connection Note : this requires setting 'PG4WP_INSECURE' to true in db.php for PG4WP to accept this
  • Some code optimizations


  • Somewhat improved WordPress plugins compatibility
  • Added 'PG4WP_INSECURE' parameter for future use
  • Split 'db.php' to be just some kind of loader for PG4WP to ease upgrading
  • Improved Akismet compatibility
  • Upgrading works with minor errors (PostgreSQL complains about already existing relations) Tested successfully : 2.9.2 to 3.0.6 - 2.9.2 to 3.1.4 - 2.9.2 to 3.2.1
  • Support for WordPress up to 3.2.1 (Installing WP 2.9.2, 3.0.6, 3.1.4 and 3.2.1 works smoothly)
  • Implemented a generic "INTERVAL xx DAY|HOUR|MINUTE|SECOND" handler
  • Backticks and capital text containing 'ID' now work
  • Improved db.php to remove notices and possible fatal errors
  • Improved dates functions handling
  • PG4WP now appears in WordPress control panel and can be enabled/disabled but this has no real effect
  • Added a correct plugin header into db.php to have correct informations shown in WordPress plugin Directory


  • This release is identical to 1.1.0rc4, just has error logging deactivated in the distribution


  • Corrected a typo in permalinks handling


  • Reordered the date_funcs array (Thanks to Boris HUISGEN for reporting the problem and submitting a patch)
  • Moved the hack about WP using meta_value = integer (instead of text) out of the SELECT handler
  • Boris HUISGEN submitted a patch for permalinks to work properly


  • Hack for WP using meta_value = integer (instead of text)
  • Moved parts required only when installing/upgrading from driver_pgsql.php to a separate file The file is loaded only when needed so that memory footprint should be a bit smaller
  • Added UNIX_TIMESTAMP support
  • Added DATE_SUB support for Akismet 2.2.7
  • Added DAYOFMONTH support (Thanks to Pete Deffendol for noticing the problem)
  • Upgrading from WP 2.8.6 to WP 2.9.1 works with a minor error Upgrading should remove an index on table "wp_options" that may not exist, throwing an error
  • Installing WP 2.9.1 works smoothly
  • Generic hack to avoid duplicate index names
  • REGEXP gets replaced with '~'
  • Added a hack to handle "ON DUPLICATE KEY"
  • Moved handling field names with CAPITALS near the end
  • Added support for "INTERVAL 15 DAY" found in Akismet 2.2.7


  • Updated support for plugin zdMultilang 1.2.5
  • Got rid of some remaining hardcoded table prefix
  • Added the possibility to log only errors


  • Reorganisation of directory structure
  • Updated installation procedure
  • Changed the fake server version to 4.1.3
  • Added support for Unix socket connections (just leave the "host" field empty when installing)


  • Initial stable release.
  • Code optimisation and reorganisation.
  • db.php automatically rewrites wp-db.php when loading it, so no maintenance is needed anymore It also reduces the size of the archive :)
  • Debug logs are now written in the pg4wp directory
  • Renamed the driver files


  • MySQL's DESCRIBE emulation ( for WordPress upgrade process )
  • MySQL's SHOW INDEX emulation ( for WordPress upgrade process )
  • ALTER TABLE support ( for WordPress upgrade process )
  • Added INDEX creation support when installing
  • Cleaned type conversion Array
  • Some code optimizations and cleanup
  • One debug log file for each query type
  • Tested successfully with WP 2.7.1 (Installs with no error + Upgrade to 2.8 OK with non blocking errors)
  • Tested successfully with WP 2.6.5 (Installs with no error + Upgrade to 2.8 OK with non blocking errors)
  • Tested successfully with WP 2.5.1 (Installs with no error + Upgrade to 2.8 OK)


  • Ignore errors about non existing table "wp_options" while installing WordPress when debugging is on
  • SQL_CALC_FOUND_ROWS emulation, to have correct posts paging
  • Introduced support for the ZdMultiLang plugin


  • Comments deletion now works again
  • Most specific global variables renamed to have 'pg4wp' in their name


  • Case insensitivity of MySQL 'LIKE' restored
  • Importing WordPress eXtended RSS tested and seems to work

Requires: 2.9.2 or higher
Compatible up to: 3.4.2
Last Updated: 2 years ago
Active Installs: 600+


4 out of 5 stars


Got something to say? Need help?


Not enough data

0 people say it works.
0 people say it's broken.

100,1,1 100,1,1 100,1,1
0,1,0 0,1,0 100,1,1 100,1,1 100,1,1 100,2,2
100,3,3 100,1,1
0,1,0 50,2,1 100,1,1 100,1,1 50,4,2
100,2,2 100,1,1 100,1,1
25,4,1 100,1,1