提交 c518b335 编写于 作者: S Serge Rider

PG: table refresh fix

Former-commit-id: 568f68a7
上级 9fa752c2
......@@ -140,11 +140,6 @@ public class PostgreSequence extends PostgreTableBase implements DBSSequence, DB
///////////////////////////////////////////////////////////////////////
// Entity
@Override
public DBSObject refreshObject(@NotNull DBRProgressMonitor monitor) throws DBException {
return this;
}
@NotNull
@Override
public DBSEntityType getEntityType() {
......
......@@ -31,10 +31,10 @@ import org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCSession;
import org.jkiss.dbeaver.model.impl.SimpleObjectCache;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils;
import org.jkiss.dbeaver.model.meta.*;
import org.jkiss.dbeaver.model.meta.Association;
import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSEntityAssociation;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.dbeaver.model.struct.rdb.DBSTableIndex;
import org.jkiss.utils.CommonUtils;
......@@ -102,17 +102,6 @@ public abstract class PostgreTable extends PostgreTableReal implements DBDPseudo
return getSchema().indexCache.getObjects(monitor, getSchema(), this);
}
@Override
public DBSObject refreshObject(@NotNull DBRProgressMonitor monitor) throws DBException
{
super.refreshObject(monitor);
getContainer().indexCache.clearObjectCache(this);
foreignKeys.clearCache();
superTables = null;
subTables = null;
return this;
}
@Override
public String getObjectDefinitionText(DBRProgressMonitor monitor) throws DBException {
return JDBCUtils.generateTableDDL(monitor, this, false);
......
......@@ -24,7 +24,6 @@ import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.DBPEvaluationContext;
import org.jkiss.dbeaver.model.DBPNamedObject2;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCSession;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils;
import org.jkiss.dbeaver.model.impl.jdbc.cache.JDBCStructCache;
import org.jkiss.dbeaver.model.impl.jdbc.struct.JDBCTable;
......@@ -35,7 +34,6 @@ import org.jkiss.dbeaver.model.struct.DBSEntityAssociation;
import org.jkiss.dbeaver.model.struct.DBSObject;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collection;
import java.util.List;
......@@ -153,24 +151,7 @@ public abstract class PostgreTableBase extends JDBCTable<PostgreDataSource, Post
@Override
public DBSObject refreshObject(@NotNull DBRProgressMonitor monitor) throws DBException
{
getContainer().tableCache.clearChildrenCache(this);
getContainer().constraintCache.clearObjectCache(this);
getContainer().indexCache.clearObjectCache(this);
if (oid == 0) {
// New table - read OID
try (JDBCSession session = DBUtils.openMetaSession(monitor, getDataSource(), "Read procedure body")) {
final Number newOid = JDBCUtils.queryObject(session,
"SELECT oid FROM pg_catalog.pg_class c WHERE c.relnamespace=? AND c.relname=?", getSchema().getObjectId(), getName());
if (newOid != null) {
this.oid = newOid.intValue();
}
} catch (SQLException e) {
throw new DBException("Error reading procedure body", e);
}
}
return this;
return getContainer().tableCache.refreshObject(monitor, getContainer(), this);
}
}
......@@ -32,7 +32,6 @@ import org.jkiss.dbeaver.model.impl.jdbc.cache.JDBCObjectCache;
import org.jkiss.dbeaver.model.meta.Association;
import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSObject;
import java.sql.ResultSet;
import java.sql.SQLException;
......@@ -136,17 +135,6 @@ public abstract class PostgreTableReal extends PostgreTableBase
return getSchema().constraintCache.getObject(monitor, getSchema(), this, ukName);
}
@Override
public DBSObject refreshObject(@NotNull DBRProgressMonitor monitor) throws DBException
{
rowCount = null;
diskSpace = null;
triggerCache.clearCache();
super.refreshObject(monitor);
return this;
}
@Association
public Collection<PostgreTrigger> getTriggers(DBRProgressMonitor monitor)
throws DBException
......
......@@ -19,20 +19,17 @@ package org.jkiss.dbeaver.ext.postgresql.model;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.model.DBPEvaluationContext;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCSession;
import org.jkiss.dbeaver.model.impl.DBObjectNameCaseTransformer;
import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils;
import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.dbeaver.model.struct.rdb.DBSTableIndex;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collection;
import java.util.List;
/**
* PostgreViewBase
......@@ -73,14 +70,6 @@ public abstract class PostgreViewBase extends PostgreTableReal
return null;
}
@Override
public DBSObject refreshObject(@NotNull DBRProgressMonitor monitor) throws DBException
{
source = null;
super.refreshObject(monitor);
return this;
}
public String getSource() {
return source;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册