[wp-trac] [WordPress Trac] #4678: PostgreSQL support ( patch included )

WordPress Trac wp-trac at lists.automattic.com
Fri Jul 27 21:31:03 GMT 2007

#4678: PostgreSQL support ( patch included )
 Reporter:  usleepless      |       Owner:  anonymous
     Type:  enhancement     |      Status:  new      
 Priority:  normal          |   Milestone:           
Component:  Administration  |     Version:  2.2.1    
 Severity:  normal          |    Keywords:           
 this is a patch to make WP 2.2.1 PostgreSQL compatible.

 to make it work:
  - edit wp-includes/wp-db.php
    add "require_once('mysql2pgsql.php') at the top
  - save the attached mysql2pgsql.php to wp-includes
  - edit wp-settings.php and remove the MySQL not included warning/die
  - make sure your php doesn't load the mysql client/module
  - create a new database ( createdb wordpress ), edit your wp-config.php
 and complete the wp-installion process

 afaik, there are no problems.

 this is "a" solution to the multiple database support "problem".

  - this patch redefines the mysql_* calls: it would be better to use the
 PEAR db-wrapper class for example
  - this patch manipulates the SQL. stuff can be learned from this though:

  - using "SHOW TABLES" to check if WP is already installed is MySQL
 specific: trying to "SELECT * FROM wp_posts LIMIT 1" is not.
  - a couple of queries use the "`" character for no reason whatsoever
  - datatypes: some translation will always be necessary ( text/memo fields
 for example ). but is using "longtext & mediumtext & tinytext" really
 sensible? or int(11), int(4), bigint(20) and tinyint(1) ?
  - almost all of the schema is lowercase: there are some table using
 capitals for fields containing "ID". let's get rid of them ( this is
 probably really pg-speficic )
  - there are MySQL specific "IGNORE" qualifiers in INSERT statements. what
 are they good for? let's get rid of them
  - in the db-installation procedure, inserts are performed on tables with
 auto_increment fields, specifying this very field ( wp_categories,
 wp_post2cat ). trust the auto_increment, remove the values for the
 auto_increment fields. this confuses pgsql
  - SQL_FOUND_ROWS & FOUND_ROWS() is MySQL specific. i have replaced them
 with dummy's and didn't notice any difference. let's work around this
  - MySQL specific LIMIT syntax is used. let's use ISO "LIMIT x OFFSET y".
  - there is seemingly useless use of "GROUP BY" in some statements. let's
 get rid of them (pgsql complains)
  - using "!=" is not ISO afaik. let's write "<>" instead

 if these suggestions are implemented, WP can be made multiple DB
 compatible quite easily ( mysql, pgsql, mssql, db2 etc. whatever PHP
 supports )

 i am willing to contribute time & patches to make this work.



Ticket URL: <http://trac.wordpress.org/ticket/4678>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list