Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
38237e37
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
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,发现更多精彩内容 >>
提交
38237e37
编写于
12月 14, 2017
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
#2624 PsotgreSQL: move child tables back to table list.
上级
1e7bf30d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
23 addition
and
26 deletion
+23
-26
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreSchema.java
...org/jkiss/dbeaver/ext/postgresql/model/PostgreSchema.java
+1
-1
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreTable.java
.../org/jkiss/dbeaver/ext/postgresql/model/PostgreTable.java
+21
-10
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreTableBase.java
.../jkiss/dbeaver/ext/postgresql/model/PostgreTableBase.java
+1
-15
未找到文件。
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreSchema.java
浏览文件 @
38237e37
...
...
@@ -196,7 +196,7 @@ public class PostgreSchema implements DBSSchema, DBPNamedObject2, DBPSaveableObj
{
return
tableCache
.
getTypedObjects
(
monitor
,
this
,
PostgreTable
.
class
)
.
stream
()
.
filter
(
table
->
table
.
getParents
()
==
null
)
.
filter
(
table
->
!
table
.
isPartition
()
)
.
collect
(
Collectors
.
toCollection
(
ArrayList:
:
new
));
}
...
...
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreTable.java
浏览文件 @
38237e37
...
...
@@ -174,6 +174,9 @@ public abstract class PostgreTable extends PostgreTableReal implements DBDPseudo
return
result
;
}
/**
* Sub tables = child tables
*/
@Property
(
viewable
=
false
,
order
=
31
)
public
List
<
PostgreTableBase
>
getSubTables
(
DBRProgressMonitor
monitor
)
throws
DBException
{
final
List
<
PostgreTableInheritance
>
si
=
getSubInheritance
(
monitor
);
...
...
@@ -182,7 +185,10 @@ public abstract class PostgreTable extends PostgreTableReal implements DBDPseudo
}
List
<
PostgreTableBase
>
result
=
new
ArrayList
<>(
si
.
size
());
for
(
int
i1
=
0
;
i1
<
si
.
size
();
i1
++)
{
result
.
add
(
si
.
get
(
i1
).
getParentObject
());
PostgreTableBase
table
=
si
.
get
(
i1
).
getParentObject
();
if
(!
table
.
isPartition
())
{
result
.
add
(
table
);
}
}
return
result
;
}
...
...
@@ -240,9 +246,9 @@ public abstract class PostgreTable extends PostgreTableReal implements DBDPseudo
String
sql
=
"SELECT i.*,c.relnamespace "
+
"FROM pg_catalog.pg_inherits i,pg_catalog.pg_class c "
+
"WHERE i.inhparent=? AND c.oid=i.inhrelid"
;
if
(
getDataSource
().
isServerVersionAtLeast
(
10
,
0
))
{
sql
+=
" AND c.relispartition=false"
;
}
//
if (getDataSource().isServerVersionAtLeast(10, 0)) {
//
sql += " AND c.relispartition=false";
//
}
try
(
JDBCPreparedStatement
dbStat
=
session
.
prepareStatement
(
sql
))
{
dbStat
.
setLong
(
1
,
getObjectId
());
try
(
JDBCResultSet
dbResult
=
dbStat
.
executeQuery
())
{
...
...
@@ -277,20 +283,25 @@ public abstract class PostgreTable extends PostgreTableReal implements DBDPseudo
if
(
subTables
==
null
)
{
subTables
=
Collections
.
emptyList
();
}
DBUtils
.
orderObjects
(
subTables
);
}
return
subTables
;
}
// TODO: fix partitions lookup (similar to getSubInheritance). Partitions may reside in different schema.
@Association
public
Collection
<
PostgreTableBase
>
getPartitions
(
DBRProgressMonitor
monitor
)
throws
DBException
{
List
<
PostgreTableBase
>
partitions
=
new
ArrayList
<>();
for
(
PostgreTableBase
t
:
getSchema
().
tableCache
.
getCachedObjects
())
{
if
(
t
.
isParentOf
(
this
.
getObjectId
())
&&
t
.
isPartition
())
{
partitions
.
add
(
t
);
final
List
<
PostgreTableInheritance
>
si
=
getSubInheritance
(
monitor
);
if
(
si
.
isEmpty
())
{
return
Collections
.
emptyList
();
}
List
<
PostgreTableBase
>
result
=
new
ArrayList
<>(
si
.
size
());
for
(
int
i1
=
0
;
i1
<
si
.
size
();
i1
++)
{
PostgreTableBase
table
=
si
.
get
(
i1
).
getParentObject
();
if
(
table
.
isPartition
())
{
result
.
add
(
table
);
}
}
return
partitions
;
return
result
;
}
}
plugins/org.jkiss.dbeaver.ext.postgresql/src/org/jkiss/dbeaver/ext/postgresql/model/PostgreTableBase.java
浏览文件 @
38237e37
...
...
@@ -67,9 +67,7 @@ public abstract class PostgreTableBase extends JDBCTable<PostgreDataSource, Post
this
.
ownerId
=
JDBCUtils
.
safeGetLong
(
dbResult
,
"relowner"
);
this
.
description
=
JDBCUtils
.
safeGetString
(
dbResult
,
"description"
);
this
.
parents
=
JDBCUtils
.
safeGetArray
(
dbResult
,
"parents"
);
Boolean
isP
=
JDBCUtils
.
safeGetBoolean
(
dbResult
,
"relispartition"
);
this
.
isPartition
=
isP
==
null
?
false
:
isP
;
this
.
isPartition
=
JDBCUtils
.
safeGetBoolean
(
dbResult
,
"relispartition"
);
}
// Copy constructor
...
...
@@ -230,18 +228,6 @@ public abstract class PostgreTableBase extends JDBCTable<PostgreDataSource, Post
}
}
public
Long
[]
getParents
()
{
return
parents
;
}
public
boolean
isParentOf
(
long
oid
){
if
(
parents
==
null
)
return
false
;
for
(
long
l
:
parents
)
{
if
(
l
==
oid
)
return
true
;
}
return
false
;
}
public
boolean
isPartition
()
{
return
isPartition
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录