diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractTable.java b/jOOQ/src/main/java/org/jooq/impl/AbstractTable.java index a76dcdae19..acda5d68ce 100644 --- a/jOOQ/src/main/java/org/jooq/impl/AbstractTable.java +++ b/jOOQ/src/main/java/org/jooq/impl/AbstractTable.java @@ -515,7 +515,7 @@ abstract class AbstractTable extends AbstractQueryPart impleme UniqueKey thisPK = this.getPrimaryKey(); UniqueKey thatPK = that.getPrimaryKey(); - if (thisPK != null && thatPK != null) { + if (thisPK != null && thatPK != null && thisPK.getTable().equals(thatPK.getTable())) { return row(fields(thisPK.getFieldsArray())).eq(row(that.fields(thatPK.getFieldsArray()))); } else { @@ -533,7 +533,7 @@ abstract class AbstractTable extends AbstractQueryPart impleme UniqueKey thisPK = this.getPrimaryKey(); UniqueKey thatPK = that.getPrimaryKey(); - if (thisPK != null && thatPK != null) { + if (thisPK != null && thatPK != null && thisPK.getTable().equals(thatPK.getTable())) { return row(fields(thisPK.getFieldsArray())).ne(row(that.fields(thatPK.getFieldsArray()))); } else {