提交 6b33677a 编写于 作者: S Serge Rider

#9457 Table columns recognition fix (PG-specific)

上级 0f78f186
......@@ -90,6 +90,11 @@ public class PostgreServerGreenplum extends PostgreServerExtensionBase {
"LOG", "ERRORS");
}
@Override
public boolean supportsEntityMetadataInResults() {
return true;
}
@Override
public boolean supportsExplainPlanXML() {
return false;
......
......@@ -44,8 +44,8 @@ class PostgreDataSourceInfo extends JDBCDataSourceInfo {
}
@Override
public boolean supportsDuplicateColumnsInResults() {
return true;
public boolean needsTableMetaForColumnResolution() {
return dataSource.getServerType().supportsEntityMetadataInResults();
}
@Override
......
......@@ -121,4 +121,8 @@ public interface PostgreServerExtension
Map<String, String> getDataTypeAliases();
boolean supportsTableStatistics();
// True if driver returns source table name in ResultSetMetaData.
// It works for original PG driver but doesn't work for many forks (e.g. Redshift).
boolean supportsEntityMetadataInResults();
}
......@@ -29,6 +29,11 @@ public class PostgreServerEdb extends PostgreServerExtensionBase {
super(dataSource);
}
@Override
public boolean supportsEntityMetadataInResults() {
return true;
}
@Override
public String getServerTypeName() {
return "EnterpriseDB";
......
......@@ -338,6 +338,11 @@ public abstract class PostgreServerExtensionBase implements PostgreServerExtensi
return true;
}
@Override
public boolean supportsEntityMetadataInResults() {
return false;
}
@Override
public boolean supportsExplainPlan() {
return true;
......
......@@ -29,6 +29,11 @@ public class PostgreServerPostgreSQL extends PostgreServerExtensionBase {
super(dataSource);
}
@Override
public boolean supportsEntityMetadataInResults() {
return true;
}
@Override
public String getServerTypeName() {
return "PostgreSQL";
......
......@@ -172,5 +172,5 @@ public interface DBPDataSourceInfo
DBSObjectType[] getSupportedObjectTypes();
boolean supportsDuplicateColumnsInResults();
boolean needsTableMetaForColumnResolution();
}
......@@ -704,7 +704,7 @@ public class DBExecUtils {
// - We use some explicit entity (e.g. table data editor)
// - Table metadata was specified for column
// - Database doesn't support column name collisions (default)
(sourceEntity != null || bindingMeta.getMetaAttribute().getEntityMetaData() != null || !bindingMeta.getDataSource().getInfo().supportsDuplicateColumnsInResults()) &&
(sourceEntity != null || bindingMeta.getMetaAttribute().getEntityMetaData() != null || !bindingMeta.getDataSource().getInfo().needsTableMetaForColumnResolution()) &&
bindingMeta.setEntityAttribute(
tableColumn,
((sqlQuery == null || tableColumn.getTypeID() != attrMeta.getTypeID()) && rows != null)))
......
......@@ -116,7 +116,7 @@ public abstract class AbstractDataSourceInfo implements DBPDataSourceInfo
}
@Override
public boolean supportsDuplicateColumnsInResults() {
public boolean needsTableMetaForColumnResolution() {
return false;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册