Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
c1c6da68
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dbeaver
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c1c6da68
编写于
1月 13, 2021
作者:
S
Serge Rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#10081 GP: child and partition tables loading fix
Former-commit-id:
914a255b
上级
b8c4c7bb
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
26 addition
and
6 deletion
+26
-6
plugins/org.jkiss.dbeaver.ext.greenplum/src/org/jkiss/dbeaver/ext/greenplum/model/GreenplumSchema.java
...rg/jkiss/dbeaver/ext/greenplum/model/GreenplumSchema.java
+9
-2
plugins/org.jkiss.dbeaver.ext.greenplum/src/org/jkiss/dbeaver/ext/greenplum/model/PostgreServerGreenplum.java
...s/dbeaver/ext/greenplum/model/PostgreServerGreenplum.java
+5
-0
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreSchema.java
...org/jkiss/dbeaver/ext/postgresql/model/PostgreSchema.java
+7
-3
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreTable.java
.../org/jkiss/dbeaver/ext/postgresql/model/PostgreTable.java
+4
-1
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreTablePartition.java
...s/dbeaver/ext/postgresql/model/PostgreTablePartition.java
+1
-0
未找到文件。
plugins/org.jkiss.dbeaver.ext.greenplum/src/org/jkiss/dbeaver/ext/greenplum/model/GreenplumSchema.java
浏览文件 @
c1c6da68
...
...
@@ -28,9 +28,11 @@ import org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCSession
;
import
org.jkiss.dbeaver.model.exec.jdbc.JDBCStatement
;
import
org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils
;
import
org.jkiss.dbeaver.model.impl.jdbc.struct.JDBCTable
;
import
org.jkiss.dbeaver.model.meta.Association
;
import
org.jkiss.dbeaver.model.runtime.DBRProgressMonitor
;
import
org.jkiss.utils.CommonUtils
;
import
java.sql.SQLException
;
import
java.util.ArrayList
;
...
...
@@ -80,7 +82,7 @@ public class GreenplumSchema extends PostgreSchema {
getDataSource
().
isGreenplumVersionAtLeast
(
session
.
getProgressMonitor
(),
5
,
0
)
?
"urilocation"
:
"location"
;
String
execLocationColumn
=
getDataSource
().
isGreenplumVersionAtLeast
(
session
.
getProgressMonitor
(),
5
,
0
)
?
"execlocation"
:
"location"
;
StringBuilder
sqlQuery
=
new
StringBuilder
(
"SELECT c.oid,d.description,
c.*,\n"
+
StringBuilder
sqlQuery
=
new
StringBuilder
(
"SELECT c.oid,d.description,
p.partitiontablename,
c.*,\n"
+
"CASE WHEN x."
+
uriLocationColumn
+
" IS NOT NULL THEN array_to_string(x."
+
uriLocationColumn
+
", ',') ELSE '' END AS urilocation,\n"
+
"CASE WHEN x.command IS NOT NULL THEN x.command ELSE '' END AS command,\n"
+
"x.fmttype, x.fmtopts,\n"
+
...
...
@@ -100,7 +102,7 @@ public class GreenplumSchema extends PostgreSchema {
"LEFT OUTER JOIN pg_catalog.pg_description d\n\tON d.objoid=c.oid AND d.objsubid=0\n"
+
"LEFT OUTER JOIN pg_catalog.pg_exttable x\n\ton x.reloid = c.oid\n"
+
"LEFT OUTER JOIN pg_catalog.pg_partitions p\n\ton c.relname = p.partitiontablename and ns.nspname = p.schemaname\n"
+
"WHERE c.relnamespace= ? AND c.relkind not in ('i','c')
AND p.partitiontablename is null
"
)
"WHERE c.relnamespace= ? AND c.relkind not in ('i','c') "
)
.
append
((
object
==
null
&&
objectName
==
null
?
""
:
" AND relname=?"
));
final
JDBCPreparedStatement
dbStat
=
session
.
prepareStatement
(
sqlQuery
.
toString
());
...
...
@@ -109,6 +111,11 @@ public class GreenplumSchema extends PostgreSchema {
dbStat
.
setString
(
2
,
object
!=
null
?
object
.
getName
()
:
objectName
);
return
dbStat
;
}
@Override
protected
boolean
isPartitionTableRow
(
@NotNull
JDBCResultSet
dbResult
)
{
return
!
CommonUtils
.
isEmpty
(
JDBCUtils
.
safeGetString
(
dbResult
,
"partitiontablename"
));
}
}
public
class
GreenplumFunctionsCache
extends
ProceduresCache
{
...
...
plugins/org.jkiss.dbeaver.ext.greenplum/src/org/jkiss/dbeaver/ext/greenplum/model/PostgreServerGreenplum.java
浏览文件 @
c1c6da68
...
...
@@ -128,4 +128,9 @@ public class PostgreServerGreenplum extends PostgreServerExtensionBase {
public
boolean
supportsDatabaseSize
()
{
return
true
;
}
@Override
public
boolean
supportsPartitions
()
{
return
true
;
}
}
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreSchema.java
浏览文件 @
c1c6da68
...
...
@@ -729,15 +729,19 @@ public class PostgreSchema implements
protected
PostgreTableBase
fetchObject
(
@NotNull
JDBCSession
session
,
@NotNull
PostgreTableContainer
container
,
@NotNull
JDBCResultSet
dbResult
)
throws
SQLException
,
DBException
{
final
String
kindString
=
getDataSource
().
isServerVersionAtLeast
(
10
,
0
)
&&
JDBCUtils
.
safeGetString
(
dbResult
,
"relkind"
).
equals
(
PostgreClass
.
RelKind
.
r
.
getCode
())
&&
JDBCUtils
.
safeGetBoolean
(
dbResult
,
"relispartition"
)
final
String
kindString
=
getDataSource
().
getServerType
().
supportsPartitions
()
&&
CommonUtils
.
equalObjects
(
JDBCUtils
.
safeGetString
(
dbResult
,
"relkind"
),
PostgreClass
.
RelKind
.
r
.
getCode
())
&&
isPartitionTableRow
(
dbResult
)
?
PostgreClass
.
RelKind
.
R
.
getCode
()
:
JDBCUtils
.
safeGetString
(
dbResult
,
"relkind"
);
PostgreClass
.
RelKind
kind
=
PostgreClass
.
RelKind
.
valueOf
(
kindString
);
return
container
.
getDataSource
().
getServerType
().
createRelationOfClass
(
PostgreSchema
.
this
,
kind
,
dbResult
);
}
protected
boolean
isPartitionTableRow
(
@NotNull
JDBCResultSet
dbResult
)
{
return
JDBCUtils
.
safeGetBoolean
(
dbResult
,
"relispartition"
);
}
protected
JDBCStatement
prepareChildrenStatement
(
@NotNull
JDBCSession
session
,
@NotNull
PostgreTableContainer
container
)
throws
SQLException
{
String
sql
=
"SELECT c.relname,a.*,pg_catalog.pg_get_expr(ad.adbin, ad.adrelid, true) as def_value,dsc.description"
+
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreTable.java
浏览文件 @
c1c6da68
...
...
@@ -424,7 +424,10 @@ public abstract class PostgreTable extends PostgreTableReal implements PostgreTa
if
(
CommonUtils
.
isEmpty
(
si
))
{
return
null
;
}
return
si
.
stream
().
map
(
AbstractTableConstraint:
:
getParentObject
).
collect
(
Collectors
.
toList
());
return
si
.
stream
()
.
map
(
AbstractTableConstraint:
:
getParentObject
)
.
filter
(
PostgreTableBase:
:
isPartition
)
.
collect
(
Collectors
.
toList
());
}
@Override
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreTablePartition.java
浏览文件 @
c1c6da68
...
...
@@ -45,6 +45,7 @@ public class PostgreTablePartition extends PostgreTable implements DBSTableParti
public
PostgreTablePartition
(
PostgreTableContainer
container
,
ResultSet
dbResult
)
{
super
(
container
,
dbResult
);
this
.
setPartition
(
true
);
this
.
partitionExpression
=
JDBCUtils
.
safeGetString
(
dbResult
,
"partition_expr"
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录