提交 02c6e206 编写于 作者: S serge-rider

PostgreSQL OIDs overflow fix


Former-commit-id: a9e330b1
上级 5af64c69
......@@ -79,7 +79,7 @@ public abstract class PostgreAttribute<OWNER extends DBSEntity & PostgreObject>
setName(JDBCUtils.safeGetString(dbResult, "attname"));
setOrdinalPosition(JDBCUtils.safeGetInt(dbResult, "attnum"));
setRequired(JDBCUtils.safeGetBoolean(dbResult, "attnotnull"));
final int typeId = JDBCUtils.safeGetInt(dbResult, "atttypid");
final long typeId = JDBCUtils.safeGetLong(dbResult, "atttypid");
dataType = getTable().getDatabase().getDataType(typeId);
if (dataType == null) {
throw new DBException("Attribute data type '" + typeId + "' not found");
......
......@@ -29,7 +29,7 @@ import java.sql.SQLException;
*/
public class PostgreCharset extends PostgreInformation {
private int encodingId;
private long encodingId;
private String name;
public PostgreCharset(PostgreDatabase database, ResultSet dbResult)
......@@ -43,7 +43,7 @@ public class PostgreCharset extends PostgreInformation {
throws SQLException
{
this.name = JDBCUtils.safeGetString(dbResult, "encname");
this.encodingId = JDBCUtils.safeGetInt(dbResult, "encid");
this.encodingId = JDBCUtils.safeGetLong(dbResult, "encid");
}
@NotNull
......
......@@ -72,17 +72,17 @@ public class PostgreDataType extends JDBCDataType<PostgreSchema> implements Post
"regdictionary",
};
private int typeId;
private long typeId;
private PostgreTypeType typeType;
private PostgreTypeCategory typeCategory;
private final int ownerId;
private final long ownerId;
private boolean isByValue;
private boolean isPreferred;
private String arrayDelimiter;
private int classId;
private int elementTypeId;
private int arrayItemTypeId;
private long classId;
private long elementTypeId;
private long arrayItemTypeId;
private String inputFunc;
private String outputFunc;
private String receiveFunc;
......@@ -93,16 +93,16 @@ public class PostgreDataType extends JDBCDataType<PostgreSchema> implements Post
private PostgreTypeAlign align = PostgreTypeAlign.c;
private PostgreTypeStorage storage = PostgreTypeStorage.p;
private boolean isNotNull;
private int baseTypeId;
private long baseTypeId;
private int typeMod;
private int arrayDim;
private int collationId;
private long collationId;
private String defaultValue;
private final AttributeCache attributeCache;
private Object[] enumValues;
public PostgreDataType(@NotNull JDBCSession monitor, @NotNull PostgreSchema owner, int typeId, int valueType, String name, int length, JDBCResultSet dbResult) throws DBException {
public PostgreDataType(@NotNull JDBCSession monitor, @NotNull PostgreSchema owner, long typeId, int valueType, String name, int length, JDBCResultSet dbResult) throws DBException {
super(owner, valueType, name, null, false, true, length, -1, -1);
this.typeId = typeId;
......@@ -125,13 +125,13 @@ public class PostgreDataType extends JDBCDataType<PostgreSchema> implements Post
log.debug(e);
}
this.ownerId = JDBCUtils.safeGetInt(dbResult, "typowner");
this.ownerId = JDBCUtils.safeGetLong(dbResult, "typowner");
this.isByValue = JDBCUtils.safeGetBoolean(dbResult, "typbyval");
this.isPreferred = JDBCUtils.safeGetBoolean(dbResult, "typispreferred");
this.arrayDelimiter = JDBCUtils.safeGetString(dbResult, "typdelim");
this.classId = JDBCUtils.safeGetInt(dbResult, "typrelid");
this.elementTypeId = JDBCUtils.safeGetInt(dbResult, "typelem");
this.arrayItemTypeId = JDBCUtils.safeGetInt(dbResult, "typarray");
this.classId = JDBCUtils.safeGetLong(dbResult, "typrelid");
this.elementTypeId = JDBCUtils.safeGetLong(dbResult, "typelem");
this.arrayItemTypeId = JDBCUtils.safeGetLong(dbResult, "typarray");
this.inputFunc = JDBCUtils.safeGetString(dbResult, "typinput");
this.outputFunc = JDBCUtils.safeGetString(dbResult, "typoutput");
this.receiveFunc = JDBCUtils.safeGetString(dbResult, "typreceive");
......@@ -150,10 +150,10 @@ public class PostgreDataType extends JDBCDataType<PostgreSchema> implements Post
log.debug(e);
}
this.isNotNull = JDBCUtils.safeGetBoolean(dbResult, "typnotnull");
this.baseTypeId = JDBCUtils.safeGetInt(dbResult, "typbasetype");
this.baseTypeId = JDBCUtils.safeGetLong(dbResult, "typbasetype");
this.typeMod = JDBCUtils.safeGetInt(dbResult, "typtypmod");
this.arrayDim = JDBCUtils.safeGetInt(dbResult, "typndims");
this.collationId = JDBCUtils.safeGetInt(dbResult, "typcollation");
this.collationId = JDBCUtils.safeGetLong(dbResult, "typcollation");
this.defaultValue = JDBCUtils.safeGetString(dbResult, "typdefault");
this.attributeCache = hasAttributes() ? new AttributeCache() : null;
......@@ -321,7 +321,7 @@ public class PostgreDataType extends JDBCDataType<PostgreSchema> implements Post
}
@Property(category = CAT_MODIFIERS)
public int getCollationId() {
public long getCollationId() {
return collationId;
}
......@@ -349,14 +349,14 @@ public class PostgreDataType extends JDBCDataType<PostgreSchema> implements Post
return typeType == PostgreTypeType.c && classId >= 0;
}
private PostgreDataType resolveType(int typeId) {
private PostgreDataType resolveType(long typeId) {
return getDatabase().getDataType(typeId);
}
public static PostgreDataType readDataType(@NotNull JDBCSession session, @NotNull PostgreSchema schema, @NotNull JDBCResultSet dbResult) throws SQLException, DBException
{
int schemaId = JDBCUtils.safeGetInt(dbResult, "typnamespace");
int typeId = JDBCUtils.safeGetInt(dbResult, "oid");
//long schemaId = JDBCUtils.safeGetLong(dbResult, "typnamespace");
long typeId = JDBCUtils.safeGetLong(dbResult, "oid");
String name = JDBCUtils.safeGetString(dbResult, "typname");
if (CommonUtils.isEmpty(name)) {
return null;
......@@ -379,9 +379,9 @@ public class PostgreDataType extends JDBCDataType<PostgreSchema> implements Post
valueType = Types.VARCHAR;
} else {
if (typeCategory == null) {
final int typElem = JDBCUtils.safeGetInt(dbResult, "typelem");
final long typElem = JDBCUtils.safeGetLong(dbResult, "typelem");
// In old PostgreSQL versions
switch (typeId) {
switch ((int) typeId) {
case PostgreOid.BIT:
valueType = Types.BIT;
break;
......@@ -590,7 +590,7 @@ public class PostgreDataType extends JDBCDataType<PostgreSchema> implements Post
"\nLEFT OUTER JOIN pg_catalog.pg_description dsc ON (c.oid=dsc.objoid AND a.attnum = dsc.objsubid)" +
"\nWHERE a.attnum > 0 AND NOT a.attisdropped AND c.oid=?" +
"\nORDER BY a.attnum");
dbStat.setInt(1, postgreDataType.classId);
dbStat.setLong(1, postgreDataType.classId);
return dbStat;
}
......
......@@ -41,7 +41,7 @@ import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.*;
import org.jkiss.dbeaver.model.struct.rdb.DBSCatalog;
import org.jkiss.utils.IntKeyMap;
import org.jkiss.utils.LongKeyMap;
import java.sql.SQLException;
import java.util.Collection;
......@@ -58,14 +58,14 @@ public class PostgreDatabase implements DBSInstance, DBSCatalog, DBPRefreshableO
private PostgreDataSource dataSource;
private long oid;
private String name;
private int ownerId;
private int encodingId;
private long ownerId;
private long encodingId;
private String collate;
private String ctype;
private boolean isTemplate;
private boolean allowConnect;
private int connectionLimit;
private int tablespaceId;
private long tablespaceId;
public final AuthIdCache authIdCache = new AuthIdCache();
public final AccessMethodCache accessMethodCache = new AccessMethodCache();
......@@ -75,7 +75,7 @@ public class PostgreDatabase implements DBSInstance, DBSCatalog, DBPRefreshableO
public final EncodingCache encodingCache = new EncodingCache();
public final TablespaceCache tablespaceCache = new TablespaceCache();
public final SchemaCache schemaCache = new SchemaCache();
public final IntKeyMap<PostgreDataType> dataTypeCache = new IntKeyMap<>();
public final LongKeyMap<PostgreDataType> dataTypeCache = new LongKeyMap<>();
public PostgreDatabase(PostgreDataSource dataSource, JDBCResultSet dbResult)
throws SQLException
......@@ -89,14 +89,14 @@ public class PostgreDatabase implements DBSInstance, DBSCatalog, DBPRefreshableO
{
this.oid = JDBCUtils.safeGetLong(dbResult, "oid");
this.name = JDBCUtils.safeGetString(dbResult, "datname");
this.ownerId = JDBCUtils.safeGetInt(dbResult, "datdba");
this.encodingId = JDBCUtils.safeGetInt(dbResult, "encoding");
this.ownerId = JDBCUtils.safeGetLong(dbResult, "datdba");
this.encodingId = JDBCUtils.safeGetLong(dbResult, "encoding");
this.collate = JDBCUtils.safeGetString(dbResult, "datcollate");
this.ctype = JDBCUtils.safeGetString(dbResult, "datctype");
this.isTemplate = JDBCUtils.safeGetBoolean(dbResult, "datistemplate");
this.allowConnect = JDBCUtils.safeGetBoolean(dbResult, "datallowconn");
this.connectionLimit = JDBCUtils.safeGetInt(dbResult, "datconnlimit");
this.tablespaceId = JDBCUtils.safeGetInt(dbResult, "dattablespace");
this.tablespaceId = JDBCUtils.safeGetLong(dbResult, "dattablespace");
}
@NotNull
......@@ -297,7 +297,7 @@ public class PostgreDatabase implements DBSInstance, DBSCatalog, DBPRefreshableO
return null;
}
PostgreTableBase findTable(DBRProgressMonitor monitor, int schemaId, int tableId)
PostgreTableBase findTable(DBRProgressMonitor monitor, long schemaId, long tableId)
throws DBException
{
PostgreSchema schema = getSchema(monitor, schemaId);
......@@ -395,7 +395,7 @@ public class PostgreDatabase implements DBSInstance, DBSCatalog, DBPRefreshableO
}
}
public PostgreProcedure getProcedure(DBRProgressMonitor monitor, int schemaId, int procId)
public PostgreProcedure getProcedure(DBRProgressMonitor monitor, long schemaId, long procId)
throws DBException
{
final PostgreSchema schema = getSchema(monitor, schemaId);
......@@ -405,7 +405,7 @@ public class PostgreDatabase implements DBSInstance, DBSCatalog, DBPRefreshableO
return null;
}
public PostgreDataType getDataType(int typeId) {
public PostgreDataType getDataType(long typeId) {
if (typeId <= 0) {
return null;
}
......
......@@ -35,10 +35,10 @@ public class PostgreForeignDataWrapper extends PostgreInformation {
private long oid;
private String name;
private String[] options;
private int ownerId;
private int handlerProcId;
private int validatorProcId;
private int handlerSchemaId;
private long ownerId;
private long handlerProcId;
private long validatorProcId;
private long handlerSchemaId;
public PostgreForeignDataWrapper(PostgreDatabase database, ResultSet dbResult)
throws SQLException
......@@ -52,10 +52,10 @@ public class PostgreForeignDataWrapper extends PostgreInformation {
{
this.oid = JDBCUtils.safeGetLong(dbResult, "oid");
this.name = JDBCUtils.safeGetString(dbResult, "fdwname");
this.ownerId = JDBCUtils.safeGetInt(dbResult, "fdwowner");
this.handlerProcId = JDBCUtils.safeGetInt(dbResult, "fdwhandler");
this.validatorProcId = JDBCUtils.safeGetInt(dbResult, "fdwvalidator");
this.handlerSchemaId = JDBCUtils.safeGetInt(dbResult, "handler_schema_id");
this.ownerId = JDBCUtils.safeGetLong(dbResult, "fdwowner");
this.handlerProcId = JDBCUtils.safeGetLong(dbResult, "fdwhandler");
this.validatorProcId = JDBCUtils.safeGetLong(dbResult, "fdwvalidator");
this.handlerSchemaId = JDBCUtils.safeGetLong(dbResult, "handler_schema_id");
this.options = JDBCUtils.safeGetArray(dbResult, "fdwoptions");
}
......
......@@ -37,8 +37,8 @@ public class PostgreForeignServer extends PostgreInformation {
private String type;
private String version;
private String[] options;
private int ownerId;
private int dataWrapperId;
private long ownerId;
private long dataWrapperId;
public PostgreForeignServer(PostgreDatabase database, ResultSet dbResult)
throws SQLException
......@@ -52,8 +52,8 @@ public class PostgreForeignServer extends PostgreInformation {
{
this.oid = JDBCUtils.safeGetLong(dbResult, "oid");
this.name = JDBCUtils.safeGetString(dbResult, "srvname");
this.ownerId = JDBCUtils.safeGetInt(dbResult, "srvowner");
this.dataWrapperId = JDBCUtils.safeGetInt(dbResult, "srvfdw");
this.ownerId = JDBCUtils.safeGetLong(dbResult, "srvowner");
this.dataWrapperId = JDBCUtils.safeGetLong(dbResult, "srvfdw");
this.type = JDBCUtils.safeGetString(dbResult, "srvtype");
this.version = JDBCUtils.safeGetString(dbResult, "srvversion");
this.options = JDBCUtils.safeGetArray(dbResult, "srvoptions");
......
......@@ -48,7 +48,7 @@ public class PostgreIndex extends JDBCTableIndex<PostgreSchema, PostgreTableBase
private boolean isReady;
private String description;
private List<PostgreIndexColumn> columns = new ArrayList<>();
private int amId;
private long amId;
public PostgreIndex(PostgreTableBase parent, String indexName, ResultSet dbResult) {
super(
......@@ -67,7 +67,7 @@ public class PostgreIndex extends JDBCTableIndex<PostgreSchema, PostgreTableBase
this.isReady = JDBCUtils.safeGetBoolean(dbResult, "indisready");
this.description = JDBCUtils.safeGetString(dbResult, "description");
this.amId = JDBCUtils.safeGetInt(dbResult, "relam");
this.amId = JDBCUtils.safeGetLong(dbResult, "relam");
}
public PostgreIndex(PostgreTableBase parent, String name, DBSIndexType indexType) {
......
......@@ -31,7 +31,7 @@ public class PostgreLanguage extends PostgreInformation {
private long oid;
private String name;
private int ownerId;
private long ownerId;
private boolean userDefined;
private boolean trusted;
private String handlerId;
......@@ -50,7 +50,7 @@ public class PostgreLanguage extends PostgreInformation {
{
this.oid = JDBCUtils.safeGetLong(dbResult, "oid");
this.name = JDBCUtils.safeGetString(dbResult, "lanname");
this.ownerId = JDBCUtils.safeGetInt(dbResult, "lanowner");
this.ownerId = JDBCUtils.safeGetLong(dbResult, "lanowner");
this.userDefined = JDBCUtils.safeGetBoolean(dbResult, "lanispl");
this.trusted = JDBCUtils.safeGetBoolean(dbResult, "lanpltrusted");
this.handlerId = JDBCUtils.safeGetString(dbResult, "lanplcallfoid");
......@@ -73,7 +73,7 @@ public class PostgreLanguage extends PostgreInformation {
}
@Property(viewable = true, order = 3)
public int getOwnerId() {
public long getOwnerId() {
return ownerId;
}
......
......@@ -77,8 +77,8 @@ public class PostgreProcedure extends AbstractProcedure<PostgreDataSource, Postg
private long oid;
private String procSrc;
private String body;
private int ownerId;
private int languageId;
private long ownerId;
private long languageId;
private float execCost;
private float estRows;
private PostgreDataType varArrayType;
......@@ -113,8 +113,8 @@ public class PostgreProcedure extends AbstractProcedure<PostgreDataSource, Postg
private void loadInfo(ResultSet dbResult) {
this.oid = JDBCUtils.safeGetLong(dbResult, "oid");
setName(JDBCUtils.safeGetString(dbResult, "proname"));
this.ownerId = JDBCUtils.safeGetInt(dbResult, "proowner");
this.languageId = JDBCUtils.safeGetInt(dbResult, "prolang");
this.ownerId = JDBCUtils.safeGetLong(dbResult, "proowner");
this.languageId = JDBCUtils.safeGetLong(dbResult, "prolang");
this.execCost = JDBCUtils.safeGetFloat(dbResult, "procost");
this.estRows = JDBCUtils.safeGetFloat(dbResult, "prorows");
......@@ -182,7 +182,7 @@ public class PostgreProcedure extends AbstractProcedure<PostgreDataSource, Postg
}
{
final int varTypeId = JDBCUtils.safeGetInt(dbResult, "provariadic");
final long varTypeId = JDBCUtils.safeGetLong(dbResult, "provariadic");
if (varTypeId != 0) {
varArrayType = container.getDatabase().getDataType(varTypeId);
}
......@@ -200,7 +200,7 @@ public class PostgreProcedure extends AbstractProcedure<PostgreDataSource, Postg
log.debug(e);
}
{
final int retTypeId = JDBCUtils.safeGetInt(dbResult, "prorettype");
final long retTypeId = JDBCUtils.safeGetLong(dbResult, "prorettype");
if (retTypeId != 0) {
returnType = container.getDatabase().getDataType(retTypeId);
}
......
......@@ -92,7 +92,7 @@ public class PostgreSchema implements DBSSchema, DBPSaveableObject, DBPRefreshab
throws SQLException
{
this.oid = JDBCUtils.safeGetLong(dbResult, "oid");
this.ownerId = JDBCUtils.safeGetInt(dbResult, "nspowner");
this.ownerId = JDBCUtils.safeGetLong(dbResult, "nspowner");
this.persisted = true;
}
......@@ -171,7 +171,7 @@ public class PostgreSchema implements DBSSchema, DBPSaveableObject, DBPRefreshab
return indexCache.getObjects(monitor, this, null);
}
public PostgreTableBase getTable(DBRProgressMonitor monitor, int tableId)
public PostgreTableBase getTable(DBRProgressMonitor monitor, long tableId)
throws DBException
{
for (PostgreClass table : tableCache.getAllObjects(monitor, this)) {
......
......@@ -138,8 +138,8 @@ public class PostgreStructureAssistant extends JDBCStructureAssistant
if (monitor.isCanceled()) {
break;
}
final int schemaId = JDBCUtils.safeGetInt(dbResult, "relnamespace");
final int tableId = JDBCUtils.safeGetInt(dbResult, "oid");
final long schemaId = JDBCUtils.safeGetLong(dbResult, "relnamespace");
final long tableId = JDBCUtils.safeGetLong(dbResult, "oid");
final String tableName = JDBCUtils.safeGetString(dbResult, "relname");
final PostgreSchema tableSchema = dataSource.getDefaultInstance().getSchema(session.getProgressMonitor(), schemaId);
objects.add(new AbstractObjectReference(tableName, tableSchema, null, RelationalObjectType.TYPE_TABLE) {
......@@ -178,8 +178,8 @@ public class PostgreStructureAssistant extends JDBCStructureAssistant
if (monitor.isCanceled()) {
break;
}
final int schemaId = JDBCUtils.safeGetInt(dbResult, "pronamespace");
final int procId = JDBCUtils.safeGetInt(dbResult, "oid");
final long schemaId = JDBCUtils.safeGetLong(dbResult, "pronamespace");
final long procId = JDBCUtils.safeGetLong(dbResult, "oid");
final String procName = JDBCUtils.safeGetString(dbResult, "proname");
final PostgreSchema procSchema = dataSource.getDefaultInstance().getSchema(session.getProgressMonitor(), schemaId);
objects.add(new AbstractObjectReference(procName, procSchema, null, RelationalObjectType.TYPE_PROCEDURE) {
......@@ -218,8 +218,8 @@ public class PostgreStructureAssistant extends JDBCStructureAssistant
if (monitor.isCanceled()) {
break;
}
final int schemaId = JDBCUtils.safeGetInt(dbResult, "connamespace");
final int constrId = JDBCUtils.safeGetInt(dbResult, "oid");
final long schemaId = JDBCUtils.safeGetLong(dbResult, "connamespace");
final long constrId = JDBCUtils.safeGetLong(dbResult, "oid");
final String constrName = JDBCUtils.safeGetString(dbResult, "conname");
final PostgreSchema constrSchema = dataSource.getDefaultInstance().getSchema(session.getProgressMonitor(), schemaId);
objects.add(new AbstractObjectReference(constrName, constrSchema, null, RelationalObjectType.TYPE_TABLE) {
......
......@@ -51,7 +51,7 @@ public abstract class PostgreTable extends PostgreTableReal implements DBDPseudo
private SimpleObjectCache<PostgreTable, PostgreTableForeignKey> foreignKeys = new SimpleObjectCache<>();
private boolean hasOids;
private int tablespaceId;
private long tablespaceId;
private List<PostgreTableInheritance> superTables;
private List<PostgreTableInheritance> subTables;
......@@ -67,7 +67,7 @@ public abstract class PostgreTable extends PostgreTableReal implements DBDPseudo
super(catalog, dbResult);
this.hasOids = JDBCUtils.safeGetBoolean(dbResult, "relhasoids");
this.tablespaceId = JDBCUtils.safeGetInt(dbResult, "reltablespace");
this.tablespaceId = JDBCUtils.safeGetLong(dbResult, "reltablespace");
}
public SimpleObjectCache<PostgreTable, PostgreTableForeignKey> getForeignKeyCache() {
......@@ -199,8 +199,8 @@ public abstract class PostgreTable extends PostgreTableReal implements DBDPseudo
dbStat.setLong(1, getObjectId());
try (JDBCResultSet dbResult = dbStat.executeQuery()) {
while (dbResult.next()) {
final int parentSchemaId = JDBCUtils.safeGetInt(dbResult, "relnamespace");
final int parentTableId = JDBCUtils.safeGetInt(dbResult, "inhparent");
final long parentSchemaId = JDBCUtils.safeGetLong(dbResult, "relnamespace");
final long parentTableId = JDBCUtils.safeGetLong(dbResult, "inhparent");
PostgreSchema schema = getDatabase().getSchema(monitor, parentSchemaId);
if (schema == null) {
log.warn("Can't find parent table's schema '" + parentSchemaId + "'");
......@@ -244,8 +244,8 @@ public abstract class PostgreTable extends PostgreTableReal implements DBDPseudo
dbStat.setLong(1, getObjectId());
try (JDBCResultSet dbResult = dbStat.executeQuery()) {
while (dbResult.next()) {
final int subSchemaId = JDBCUtils.safeGetInt(dbResult, "relnamespace");
final int subTableId = JDBCUtils.safeGetInt(dbResult, "inhrelid");
final long subSchemaId = JDBCUtils.safeGetLong(dbResult, "relnamespace");
final long subTableId = JDBCUtils.safeGetLong(dbResult, "inhrelid");
PostgreSchema schema = getDatabase().getSchema(monitor, subSchemaId);
if (schema == null) {
log.warn("Can't find sub-table's schema '" + subSchemaId + "'");
......
......@@ -40,7 +40,7 @@ import java.sql.SQLException;
*/
public class PostgreTableForeign extends PostgreTable implements DBPImageProvider
{
private int foreignServerId;
private long foreignServerId;
private String[] foreignOptions;
public PostgreTableForeign(PostgreSchema catalog)
......@@ -76,7 +76,7 @@ public class PostgreTableForeign extends PostgreTable implements DBPImageProvide
stat.setLong(1, getObjectId());
try (JDBCResultSet result = stat.executeQuery()) {
if (result.next()) {
foreignServerId = JDBCUtils.safeGetInt(result, "ftserver");
foreignServerId = JDBCUtils.safeGetLong(result, "ftserver");
foreignOptions = JDBCUtils.safeGetArray(result, "ftoptions");
}
}
......
......@@ -55,8 +55,8 @@ public class PostgreTableForeignKey extends PostgreTableConstraintBase implement
deleteRule = getRuleFromAction(JDBCUtils.safeGetString(resultSet, "confdeltype"));
final DBRProgressMonitor monitor = resultSet.getSession().getProgressMonitor();
final int refSchemaId = JDBCUtils.safeGetInt(resultSet, "refnamespace");
final int refTableId = JDBCUtils.safeGetInt(resultSet, "confrelid");
final long refSchemaId = JDBCUtils.safeGetLong(resultSet, "refnamespace");
final long refTableId = JDBCUtils.safeGetLong(resultSet, "confrelid");
refTable = table.getDatabase().findTable(
monitor,
refSchemaId,
......@@ -134,7 +134,9 @@ public class PostgreTableForeignKey extends PostgreTableConstraintBase implement
columns.addAll((Collection<? extends PostgreTableForeignKeyColumn>) children);
final List<PostgreAttribute> lst = new ArrayList<>(children.size());
for (PostgreTableConstraintColumn c : children) lst.add(((PostgreTableForeignKeyColumn)c).getReferencedColumn());
for (PostgreTableConstraintColumn c : children) {
lst.add(((PostgreTableForeignKeyColumn)c).getReferencedColumn());
}
try {
refConstraint = DBUtils.findEntityConstraint(monitor, refTable, lst);
} catch (DBException e) {
......
......@@ -34,7 +34,7 @@ public class PostgreTablespace extends PostgreInformation {
private long oid;
private String name;
private int ownerId;
private long ownerId;
private Object[] options;
public PostgreTablespace(PostgreDatabase database, ResultSet dbResult)
......@@ -49,7 +49,7 @@ public class PostgreTablespace extends PostgreInformation {
{
this.oid = JDBCUtils.safeGetLong(dbResult, "oid");
this.name = JDBCUtils.safeGetString(dbResult, "spcname");
this.ownerId = JDBCUtils.safeGetInt(dbResult, "spcowner");
this.ownerId = JDBCUtils.safeGetLong(dbResult, "spcowner");
this.options = JDBCUtils.safeGetArray(dbResult, "spcoptions");
}
......
......@@ -32,7 +32,7 @@ public class PostgreSession implements DBAServerSession {
private static final String CAT_CLIENT = "Client";
private static final String CAT_TIMING = "Timings";
private int pid;
private long pid;
private String user;
private String clientHost;
private String clientPort;
......@@ -46,7 +46,7 @@ public class PostgreSession implements DBAServerSession {
private String appName;
public PostgreSession(ResultSet dbResult) {
this.pid = JDBCUtils.safeGetInt(dbResult, "pid");
this.pid = JDBCUtils.safeGetLong(dbResult, "pid");
this.user = JDBCUtils.safeGetString(dbResult, "usename");
this.clientHost = JDBCUtils.safeGetString(dbResult, "client_hostname");
if (CommonUtils.isEmpty(this.clientHost)) {
......@@ -66,7 +66,7 @@ public class PostgreSession implements DBAServerSession {
}
@Property(viewable = true, order = 1)
public int getPid()
public long getPid()
{
return pid;
}
......
......@@ -75,7 +75,7 @@ public class PostgreSessionManager implements DBAServerSessionManager<PostgreSes
{
try {
try (JDBCPreparedStatement dbStat = ((JDBCSession) session).prepareStatement("SELECT pg_catalog.pg_terminate_backend(?)")) {
dbStat.setInt(1, sessionType.getPid());
dbStat.setLong(1, sessionType.getPid());
dbStat.execute();
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册