diff --git a/org.adempiere.base/src/org/compiere/db/AdempiereDatabase.java b/org.adempiere.base/src/org/compiere/db/AdempiereDatabase.java index f992a582ce..67a7c911ec 100644 --- a/org.adempiere.base/src/org/compiere/db/AdempiereDatabase.java +++ b/org.adempiere.base/src/org/compiere/db/AdempiereDatabase.java @@ -380,7 +380,14 @@ public interface AdempiereDatabase * @return variable length character data type name */ public String getVarcharDataType(); - + + /** + * @return variable length character data type suffix + */ + public default String getVarcharLengthSuffix() { + return ""; + }; + /** * * @return binary large object data type name @@ -460,6 +467,7 @@ public interface AdempiereDatabase * @return alter column sql */ public String getSQLModify (MTable table, MColumn column, boolean setNullOption); - + + } // AdempiereDatabase diff --git a/org.adempiere.base/src/org/compiere/dbPort/Convert.java b/org.adempiere.base/src/org/compiere/dbPort/Convert.java index 67b520de63..d11707da56 100644 --- a/org.adempiere.base/src/org/compiere/dbPort/Convert.java +++ b/org.adempiere.base/src/org/compiere/dbPort/Convert.java @@ -384,7 +384,7 @@ public abstract class Convert } catch (Exception e) { String error = "Error expression: " + regex + " - " + e; - log.info(error); + log.warning(error); m_conversionError = error; } } diff --git a/org.adempiere.base/src/org/compiere/util/DisplayType.java b/org.adempiere.base/src/org/compiere/util/DisplayType.java index 9fe54ecc46..35973f0456 100644 --- a/org.adempiere.base/src/org/compiere/util/DisplayType.java +++ b/org.adempiere.base/src/org/compiere/util/DisplayType.java @@ -624,7 +624,7 @@ public final class DisplayType { if (columnName.equals("EntityType") || columnName.equals ("AD_Language")) - return getDatabase().getVarcharDataType() + "(" + fieldLength + ")"; + return getDatabase().getVarcharDataType() + "(" + fieldLength + getDatabase().getVarcharLengthSuffix() + ")"; // ID if (DisplayType.isID(displayType)) { @@ -640,7 +640,7 @@ public final class DisplayType else if (fieldLength < 4) return getDatabase().getCharacterDataType()+"(" + fieldLength + ")"; else // EntityType, AD_Language fallback - return getDatabase().getVarcharDataType()+"(" + fieldLength + ")"; + return getDatabase().getVarcharDataType()+"(" + fieldLength + getDatabase().getVarcharLengthSuffix() + ")"; } // if (displayType == DisplayType.Integer) @@ -660,10 +660,10 @@ public final class DisplayType if (fieldLength == 1) return getDatabase().getCharacterDataType()+"(" + fieldLength + ")"; else - return getDatabase().getVarcharDataType()+"(" + fieldLength + ")"; + return getDatabase().getVarcharDataType()+"(" + fieldLength + getDatabase().getVarcharLengthSuffix() + ")"; } if (displayType == DisplayType.Color) - return getDatabase().getVarcharDataType()+"(" + fieldLength + ")"; + return getDatabase().getVarcharDataType()+"(" + fieldLength + getDatabase().getVarcharLengthSuffix() + ")"; if (displayType == DisplayType.Button) { if (columnName.endsWith("_ID")) @@ -685,7 +685,7 @@ public final class DisplayType if (columnName.endsWith("_ID")) return getDatabase().getNumericDataType()+"(10)"; - return getDatabase().getVarcharDataType()+"(" + fieldLength + ")"; + return getDatabase().getVarcharDataType()+"(" + fieldLength + getDatabase().getVarcharLengthSuffix() + ")"; } // getSQLDataType /** diff --git a/org.compiere.db.oracle.provider/src/org/compiere/db/DB_Oracle.java b/org.compiere.db.oracle.provider/src/org/compiere/db/DB_Oracle.java index 92552f10d1..3323291ca9 100644 --- a/org.compiere.db.oracle.provider/src/org/compiere/db/DB_Oracle.java +++ b/org.compiere.db.oracle.provider/src/org/compiere/db/DB_Oracle.java @@ -1371,6 +1371,13 @@ public class DB_Oracle implements AdempiereDatabase return "VARCHAR2"; } + /** + * @return variable length character data type suffix + */ + public String getVarcharLengthSuffix() { + return " CHAR"; + }; + @Override public String getBlobDataType() { return "BLOB"; diff --git a/org.compiere.db.postgresql.provider/src/org/compiere/dbPort/ConvertMap_PostgreSQL.java b/org.compiere.db.postgresql.provider/src/org/compiere/dbPort/ConvertMap_PostgreSQL.java index 7037e59b7a..eb8d4fa099 100644 --- a/org.compiere.db.postgresql.provider/src/org/compiere/dbPort/ConvertMap_PostgreSQL.java +++ b/org.compiere.db.postgresql.provider/src/org/compiere/dbPort/ConvertMap_PostgreSQL.java @@ -40,7 +40,11 @@ public final class ConvertMap_PostgreSQL { // Data Types s_pg.put("\\bNUMBER\\b", "NUMERIC"); s_pg.put("\\bDATE\\b", "TIMESTAMP"); + s_pg.put("\\bVARCHAR2\\b", "VARCHAR"); + // because map is ordered this replacement is executed after VARCHAR2 above, so here we have just VARCHAR + s_pg.put("\\bVARCHAR\\b( *\\( *[1-9][0-9]*) *CHAR\\)", "VARCHAR$1)"); + s_pg.put("\\bNVARCHAR2\\b", "VARCHAR"); s_pg.put("\\bNCHAR\\b", "CHAR"); //begin vpj-cd e-evolution 03/11/2005 PostgreSQL