The backslash characters are duplicated on :
- profile name
- description of custom rule
- rule parameter
PostgreSQL 9.1 is more strict with SQL standard. It drops the "MySQLism" that accepts backslash as an escaping character. Only the single quote should be accepted regards to the standard.
This behavior is defined by the postgres property "standard_conforming_strings". Its default value has been changed to "on" in 9.1.
The problem is that Rails explicitely escapes \ with another \. It's inserted as it with postgresql 9.1 and it's correctly interpreted with 9.0. Note that escaping is correctly supported by the JDBC driver.
A solution is to force the standard_conforming_strings to "on" in JDBC connections and to stop double-backslashing in rails. It allows to support both versions 9.0 and 9.1.