diff --git a/org.adempiere.base/src/org/compiere/model/MColumn.java b/org.adempiere.base/src/org/compiere/model/MColumn.java index 98241913cb..7757e91dd2 100644 --- a/org.adempiere.base/src/org/compiere/model/MColumn.java +++ b/org.adempiere.base/src/org/compiere/model/MColumn.java @@ -592,11 +592,12 @@ public class MColumn extends X_AD_Column implements ImmutablePOSupport setSeqNoPartition(ii); } - if (is_ValueChanged(COLUMNNAME_IsPartitionKey) + // Validate partition column changes + if (!newRecord && (is_ValueChanged(COLUMNNAME_IsPartitionKey) || is_ValueChanged(COLUMNNAME_PartitioningMethod) || (isPartitionKey() && is_ValueChanged(COLUMNNAME_IsActive)) || (isPartitionKey() && is_ValueChanged(COLUMNNAME_SeqNoPartition)) - || (isPartitionKey() && is_ValueChanged(COLUMNNAME_RangePartitionInterval))) { + || (isPartitionKey() && is_ValueChanged(COLUMNNAME_RangePartitionInterval)))) { ITablePartitionService service = DB.getDatabase().getTablePartitionService(); if (service == null) { log.saveError("Error", Msg.getMsg(getCtx(), "DBAdapterNoTablePartitionSupport")); @@ -1034,6 +1035,10 @@ public class MColumn extends X_AD_Column implements ImmutablePOSupport String referenceTableName = column.getReferenceTableName(); if (referenceTableName != null) { + // Fk doesn't work for partitioned PostgreSQL table + if (DB.isPostgreSQL() && MTable.get(Env.getCtx(), referenceTableName) != null && MTable.get(Env.getCtx(), referenceTableName).isPartition()) + return null; + Hashtable htForeignKeys = new Hashtable(); if (md.storesUpperCaseIdentifiers()) {