Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
4ad9fe4c
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4ad9fe4c
编写于
10月 25, 2000
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Teach psql about new relkind for views.
上级
0a63b6d0
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
17 addition
and
20 deletion
+17
-20
src/bin/psql/describe.c
src/bin/psql/describe.c
+15
-18
src/bin/psql/tab-complete.c
src/bin/psql/tab-complete.c
+2
-2
未找到文件。
src/bin/psql/describe.c
浏览文件 @
4ad9fe4c
...
...
@@ -3,7 +3,7 @@
*
* Copyright 2000 by PostgreSQL Global Development Group
*
* $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.2
5 2000/10/24 01:38:38
tgl Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.2
6 2000/10/25 20:36:52
tgl Exp $
*/
#include "postgres.h"
#include "describe.h"
...
...
@@ -336,7 +336,7 @@ permissionsList(const char *name)
strcat
(
descbuf
,
"SELECT relname as
\"
Relation
\"
,
\n
"
" relacl as
\"
Access permissions
\"\n
"
"FROM pg_class
\n
"
"WHERE
( relkind = 'r' OR relkind =
'S') AND
\n
"
"WHERE
relkind in ('r', 'v',
'S') AND
\n
"
" relname !~ '^pg_'
\n
"
);
if
(
name
)
{
...
...
@@ -570,7 +570,7 @@ describeTableDetails(const char *name, bool desc)
headers
[
1
]
=
"Type"
;
cols
=
2
;
if
(
tableinfo
.
relkind
==
'r'
)
if
(
tableinfo
.
relkind
==
'r'
||
tableinfo
.
relkind
==
'v'
)
{
cols
++
;
headers
[
cols
-
1
]
=
"Modifier"
;
...
...
@@ -634,7 +634,7 @@ describeTableDetails(const char *name, bool desc)
/* Extra: not null and default */
/* (I'm cutting off the 'default' string at 128) */
if
(
tableinfo
.
relkind
==
'r'
)
if
(
tableinfo
.
relkind
==
'r'
||
tableinfo
.
relkind
==
'v'
)
{
cells
[
i
*
cols
+
2
]
=
xmalloc
(
128
+
128
);
cells
[
i
*
cols
+
2
][
0
]
=
'\0'
;
...
...
@@ -677,10 +677,10 @@ describeTableDetails(const char *name, bool desc)
switch
(
tableinfo
.
relkind
)
{
case
'r'
:
if
(
view_def
)
sprintf
(
title
,
"View
\"
%s
\"
"
,
name
)
;
else
sprintf
(
title
,
"Table
\"
%s
\"
"
,
name
);
sprintf
(
title
,
"Table
\"
%s
\"
"
,
name
);
break
;
case
'v'
:
sprintf
(
title
,
"View
\"
%s
\"
"
,
name
);
break
;
case
'S'
:
sprintf
(
title
,
"Sequence
\"
%s
\"
"
,
name
);
...
...
@@ -692,7 +692,8 @@ describeTableDetails(const char *name, bool desc)
sprintf
(
title
,
"Special relation
\"
%s
\"
"
,
name
);
break
;
default:
sprintf
(
title
,
"?%c?"
,
tableinfo
.
relkind
);
sprintf
(
title
,
"?%c?
\"
%s
\"
"
,
tableinfo
.
relkind
,
name
);
break
;
}
/* Make footers */
...
...
@@ -723,7 +724,7 @@ describeTableDetails(const char *name, bool desc)
}
}
/* Information about the view */
else
if
(
tableinfo
.
relkind
==
'r'
&&
view_def
)
else
if
(
view_def
)
{
footers
=
xmalloc
(
2
*
sizeof
(
*
footers
));
footers
[
0
]
=
xmalloc
(
20
+
strlen
(
view_def
));
...
...
@@ -874,7 +875,7 @@ describeTableDetails(const char *name, bool desc)
for
(
i
=
0
;
i
<
PQntuples
(
res
);
i
++
)
{
if
(
tableinfo
.
relkind
==
'r'
)
if
(
tableinfo
.
relkind
==
'r'
||
tableinfo
.
relkind
==
'v'
)
free
(
cells
[
i
*
cols
+
2
]);
}
free
(
cells
);
...
...
@@ -933,8 +934,7 @@ listTables(const char *infotype, const char *name, bool desc)
if
(
desc
)
strcat
(
buf
,
", obj_description(c.oid) as
\"
Description
\"
"
);
strcat
(
buf
,
"
\n
FROM pg_class c, pg_user u
\n
"
"WHERE c.relowner = u.usesysid AND c.relkind = 'r'
\n
"
" AND not exists (select 1 from pg_views where viewname = c.relname)
\n
"
);
"WHERE c.relowner = u.usesysid AND c.relkind = 'r'
\n
"
);
strcat
(
buf
,
showSystem
?
" AND c.relname ~ '^pg_'
\n
"
:
" AND c.relname !~ '^pg_'
\n
"
);
if
(
name
)
{
...
...
@@ -949,7 +949,6 @@ listTables(const char *infotype, const char *name, bool desc)
strcat
(
buf
,
", obj_description(c.oid) as
\"
Description
\"
"
);
strcat
(
buf
,
"
\n
FROM pg_class c
\n
"
"WHERE c.relkind = 'r'
\n
"
" AND not exists (select 1 from pg_views where viewname = c.relname)
\n
"
" AND not exists (select 1 from pg_user where usesysid = c.relowner)
\n
"
);
strcat
(
buf
,
showSystem
?
" AND c.relname ~ '^pg_'
\n
"
:
" AND c.relname !~ '^pg_'
\n
"
);
if
(
name
)
...
...
@@ -970,8 +969,7 @@ listTables(const char *infotype, const char *name, bool desc)
if
(
desc
)
strcat
(
buf
,
", obj_description(c.oid) as
\"
Description
\"
"
);
strcat
(
buf
,
"
\n
FROM pg_class c, pg_user u
\n
"
"WHERE c.relowner = u.usesysid AND c.relkind = 'r'
\n
"
" AND exists (select 1 from pg_views where viewname = c.relname)
\n
"
);
"WHERE c.relowner = u.usesysid AND c.relkind = 'v'
\n
"
);
strcat
(
buf
,
showSystem
?
" AND c.relname ~ '^pg_'
\n
"
:
" AND c.relname !~ '^pg_'
\n
"
);
if
(
name
)
{
...
...
@@ -985,8 +983,7 @@ listTables(const char *infotype, const char *name, bool desc)
if
(
desc
)
strcat
(
buf
,
", obj_description(c.oid) as
\"
Description
\"
"
);
strcat
(
buf
,
"
\n
FROM pg_class c
\n
"
"WHERE c.relkind = 'r'
\n
"
" AND exists (select 1 from pg_views where viewname = c.relname)
\n
"
"WHERE c.relkind = 'v'
\n
"
" AND not exists (select 1 from pg_user where usesysid = c.relowner)
\n
"
);
strcat
(
buf
,
showSystem
?
" AND c.relname ~ '^pg_'
\n
"
:
" AND c.relname !~ '^pg_'
\n
"
);
if
(
name
)
...
...
src/bin/psql/tab-complete.c
浏览文件 @
4ad9fe4c
...
...
@@ -3,7 +3,7 @@
*
* Copyright 2000 by PostgreSQL Global Development Group
*
* $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.2
1 2000/10/03 19:50:20 petere
Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.2
2 2000/10/25 20:36:52 tgl
Exp $
*/
/*----------------------------------------------------------------------
...
...
@@ -519,7 +519,7 @@ psql_completion(char *text, int start, int end)
*/
else
if
((
strcasecmp
(
prev3_wd
,
"GRANT"
)
==
0
||
strcasecmp
(
prev3_wd
,
"REVOKE"
)
==
0
)
&&
strcasecmp
(
prev_wd
,
"ON"
)
==
0
)
COMPLETE_WITH_QUERY
(
"SELECT relname FROM pg_class WHERE relkind in ('r','i','
s
') and substr(relname,1,%d)='%s'"
);
COMPLETE_WITH_QUERY
(
"SELECT relname FROM pg_class WHERE relkind in ('r','i','
S','v
') and substr(relname,1,%d)='%s'"
);
/* Complete "GRANT * ON * " with "TO" */
else
if
(
strcasecmp
(
prev4_wd
,
"GRANT"
)
==
0
&&
strcasecmp
(
prev2_wd
,
"ON"
)
==
0
)
COMPLETE_WITH_CONST
(
"TO"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录