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+

2 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! :)

Laissez une réponse