Skip to content
 

PG4WP compatibility with PostgreSQL 9.1+

PostgreSQL 9.1 introduces a change in the default value for the « standard_conforming_strings » parameter.

When this parameter is « on » (which is the new default), PostgreSQL will stop accepting the backslash character for escaping single quote in strings.

For now, if you want to use WordPress/PG4WP with any version of PostgreSQL starting with 9.1, you’ll need to set « standard_conforming_strings = off » in your « postgresql.conf » file.

I’ll try to find a solution for the next release of PG4WP so that it works « out of the box » with PostgreSQL 9.1+

4 commentaires

  1. Martin dit :

    The backslash-single-quote phrasing is a MySQLism and not SQL standard. The correct phrasing should be double-single-quotes.

    I don’t know if this will show up correctly but I will do my best:

    MySQL:
    INSERT INTO A (col1) VALUES(‘This is a \’single-quote test\ »);

    (near) SQL95:
    INSERT INTO A (col1) VALUES(‘This is a  »single-quote test »’);

    I corrected your plugin by adding the following to the pg4wp_rewrite() function before the final return:

    $sql = str_replace( ‘\\\ »,’\’\ »,$sql);

    Another point: I had to also add the following to remove backslashes before double-quotes:

    $sql = str_replace( ‘\\ »‘,’ »‘,$sql);

    Good luck.

  2. W8ER dit :

    I am patiencently waiting on this update! :)

  3. OneFox dit :

    Hey,
    did you test with WP 3.3.1 ?
    My Pg log is full after i create a WP page :(
    greeting
    Onefox

  4. Hawk__ dit :

    I’m working on the next release of PG4WP and I tested with up to WP 3.3.2 successfully.

    At this time PostgreSQL 9.1+ support seems to work correctly.

    If you want to try the latest development version :
    http://downloads.wordpress.org/plugin/postgresql-for-wordpress.zip

    Please leave a comment to this post if you test and have problems with quoting.