提交 635b93e9 编写于 作者: L LonwoLonwo

#10703 reading Redshift char/varchar view columns fixed

上级 c4fdacd3
......@@ -84,6 +84,7 @@ public class PostgreConstants {
"oid", "oid", "Row identifier", false);
public static final String TYPE_UUID = "uuid";
public static final String TYPE_BPCHAR = "bpchar";
public static final String TYPE_VARCHAR = "varchar";
public static final String TYPE_HSTORE = "hstore";
public static final String TYPE_JSON = "json";
......
......@@ -94,8 +94,11 @@ public class PostgreDataTypeCache extends JDBCObjectCache<PostgreSchema, Postgre
private void mapAliases(PostgreSchema schema) {
// Cache aliases
if (schema.isCatalogSchema()) {
mapDataTypeAliases(schema.getDataSource().getServerType().getDataTypeAliases(), false);
mapDataTypeAliases(PostgreConstants.SERIAL_TYPES, true);
PostgreServerExtension serverType = schema.getDataSource().getServerType();
mapDataTypeAliases(serverType.getDataTypeAliases(), false);
if (serverType.supportSerialTypes()) {
mapDataTypeAliases(PostgreConstants.SERIAL_TYPES, true);
}
}
}
......
......@@ -137,4 +137,6 @@ public interface PostgreServerExtension
boolean supportsSuperusers();
boolean supportsRolesWithCreateDBAbility();
boolean supportSerialTypes();
}
......@@ -453,4 +453,9 @@ public abstract class PostgreServerExtensionBase implements PostgreServerExtensi
public boolean supportsRolesWithCreateDBAbility() {
return supportsRoles();
}
@Override
public boolean supportSerialTypes() {
return true;
}
}
\ No newline at end of file
......@@ -19,6 +19,7 @@ package org.jkiss.dbeaver.ext.postgresql.model.impls.redshift;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.ext.postgresql.PostgreConstants;
import org.jkiss.dbeaver.ext.postgresql.model.*;
import org.jkiss.dbeaver.ext.postgresql.model.impls.PostgreServerExtensionBase;
import org.jkiss.dbeaver.model.DBUtils;
......@@ -33,6 +34,7 @@ import org.osgi.framework.Version;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -237,6 +239,19 @@ public class PostgreServerRedshift extends PostgreServerExtensionBase {
return true;
}
@Override
public boolean supportSerialTypes() {
return false;
}
@Override
public Map<String, String> getDataTypeAliases() {
Map<String, String> aliasMap = new LinkedHashMap<>(super.getDataTypeAliases());
aliasMap.put("character", PostgreConstants.TYPE_BPCHAR);
aliasMap.put("character varying", PostgreConstants.TYPE_VARCHAR);
return aliasMap;
}
@Override
public PostgreDatabase.SchemaCache createSchemaCache(PostgreDatabase database) {
return new RedshiftSchemaCache();
......
......@@ -100,6 +100,7 @@ public class RedshiftView extends PostgreView
PostgreTableColumn viewColumn = new PostgreTableColumn(this);
viewColumn.setName(colName);
viewColumn.setPersisted(true);
String colTypeName;
int colPrecision = -1, colScale = -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册