fixed bug 35467: views with several IN or NOT IN clasues fail in PG 3.0PR17Q1
authorAsier Lostalé <asier.lostale@openbravo.com>
Thu, 09 Mar 2017 08:59:50 +0100
changeset 925 285d1158f061
parent 924 dc1d0235612a
child 926 d3be29e49a89
fixed bug 35467: views with several IN or NOT IN clasues fail in PG

In PG, views that contain more than one IN or NOT IN clauses were not correctly
exported.

The regexps that parses and PG IN and NOT IN clauses was including from the begining
of 1st clause till the end of the last one.

These regexps have been fixed to be more restrictive so that they stop looking
for the IN contents on first ].
src/org/apache/ddlutils/platform/postgresql/PostgreSQLStandarization.java
--- a/src/org/apache/ddlutils/platform/postgresql/PostgreSQLStandarization.java	Thu Mar 09 08:56:11 2017 +0100
+++ b/src/org/apache/ddlutils/platform/postgresql/PostgreSQLStandarization.java	Thu Mar 09 08:59:50 2017 +0100
@@ -1,6 +1,6 @@
 /*
  ************************************************************************************
- * Copyright (C) 2001-2006 Openbravo S.L.U.
+ * Copyright (C) 2001-2017 Openbravo S.L.U.
  * Licensed under the Apache Software License version 2.0
  * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
  * Unless required by applicable law or agreed to  in writing,  software  distributed
@@ -75,9 +75,10 @@
 
     // sql "in" sentence and "not in"
     append(new ReplacePatTranslation(
-        "=\\s*[Aa][Nn][Yy]\\s*\\(\\s*[Aa][Rr][Rr][Aa][Yy]\\s*\\[(.*)\\]\\s*\\)", "IN ($1)"));
+        "=\\s*[Aa][Nn][Yy]\\s*\\(\\s*[Aa][Rr][Rr][Aa][Yy]\\s*\\[([^\\)]*)\\]\\s*\\)", "IN ($1)"));
     append(new ReplacePatTranslation(
-        "<>\\s*[Aa][Ll][Ll]\\s*\\(\\s*[Aa][Rr][Rr][Aa][Yy]\\s*\\[(.*)\\]\\s*\\)", "NOT IN ($1)"));
+        "<>\\s*[Aa][Ll][Ll]\\s*\\(\\s*[Aa][Rr][Rr][Aa][Yy]\\s*\\[([^\\)]*)\\]\\s*\\)",
+        "NOT IN ($1)"));
 
     // date truncs date_trunk('month', now()) --> trunc(now(),'MM')
     // suports 3 levels of recursivily in parenthesis -->