openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject [openjpa] 02/02: OPENJPA-2756 escape search strings for all Postgres versions
Date Sat, 10 Nov 2018 19:49:18 GMT
This is an automated email from the ASF dual-hosted git repository.

struberg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openjpa.git

commit db6f6b642203d60ae1fa7576715e180c6bbe6081
Author: Mark Struberg <struberg@apache.org>
AuthorDate: Sat Nov 10 20:47:09 2018 +0100

    OPENJPA-2756 escape search strings for all Postgres versions
    
    Can be disabled via config by explicitly setting the
    DBDictionary to requiresSearchStringEscapeForLike=false
    via persistence.xml for example.
---
 .../main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java
b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java
index 82c3dce..2ba03e0 100644
--- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java
+++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java
@@ -753,9 +753,12 @@ public class PostgresDictionary
         if ((maj >= 9 || (maj == 8 && min >= 3))) {
             supportsXMLColumn = true;
         }
+
+        // PostgreSQL requires to escape search strings
+        requiresSearchStringEscapeForLike = true;
+
         // Old PostgreSQL requires double-escape for strings.
         if ((maj <= 8 || (maj == 9 && min == 0))) {
-            requiresSearchStringEscapeForLike = true;
             searchStringEscape = "\\\\";
         }
     }


Mime
View raw message