diff --git a/plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/exec/DBExecUtils.java b/plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/exec/DBExecUtils.java index bf2f65a771baee4e1ab809e4e5295ebce39933b6..133b4c790df2ad43e11f6d30694276aad4c37d68 100644 --- a/plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/exec/DBExecUtils.java +++ b/plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/exec/DBExecUtils.java @@ -891,4 +891,23 @@ public class DBExecUtils { return actions; } + @Nullable + public static DBSEntity detectSingleSourceTable(DBDAttributeBinding ... attributes) { + // Check single source flag + DBSEntity sourceTable = null; + for (DBDAttributeBinding attribute : attributes) { + if (attribute.isPseudoAttribute()) { + continue; + } + DBDRowIdentifier rowIdentifier = attribute.getRowIdentifier(); + if (rowIdentifier != null) { + if (sourceTable == null) { + sourceTable = rowIdentifier.getEntity(); + } else if (sourceTable != rowIdentifier.getEntity()) { + return null; + } + } + } + return sourceTable; + } } \ No newline at end of file diff --git a/plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetModel.java b/plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetModel.java index 3f63bc6b3d397e6b70f509005997efe8f83702dc..67e240d2e9d0b40ee07ab308e60ff3de3bdd5e82 100644 --- a/plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetModel.java +++ b/plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/controls/resultset/ResultSetModel.java @@ -659,28 +659,8 @@ public class ResultSetModel { this.visibleAttributes.sort(POSITION_SORTER); if (singleSourceEntity == null) { - // Check single source flag - DBSEntity sourceTable = null; - for (DBDAttributeBinding attribute : visibleAttributes) { - if (attribute.isPseudoAttribute()) { - continue; - } - DBDRowIdentifier rowIdentifier = attribute.getRowIdentifier(); - if (rowIdentifier != null) { - if (sourceTable == null) { - sourceTable = rowIdentifier.getEntity(); - } else if (sourceTable != rowIdentifier.getEntity()) { - sourceTable = null; - break; - } - } else { - // Do not mark it a multi-source. - // It is just some column without identifier, probably a constant or an expression - //singleSourceCells = false; - //break; - } - } - singleSourceEntity = sourceTable; + singleSourceEntity = DBExecUtils.detectSingleSourceTable( + visibleAttributes.toArray(new DBDAttributeBinding[0])); } hasData = true;