Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
e6ed9f2c
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,发现更多精彩内容 >>
提交
e6ed9f2c
编写于
1月 20, 2000
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix typo in \z.
上级
8792af75
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
32 addition
and
32 deletion
+32
-32
src/bin/psql/describe.c
src/bin/psql/describe.c
+32
-32
未找到文件。
src/bin/psql/describe.c
浏览文件 @
e6ed9f2c
...
...
@@ -3,7 +3,7 @@
*
* Copyright 2000 by PostgreSQL Global Development Team
*
* $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.1
3 2000/01/18 23:30:23 petere
Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.1
4 2000/01/20 15:29:20 momjian
Exp $
*/
#include <c.h>
#include "describe.h"
...
...
@@ -49,10 +49,10 @@ describeAggregates(const char *name)
*/
strcpy
(
buf
,
"SELECT a.aggname AS
\"
Name
\"
, t.typname AS
\"
Type
\"
,
\n
"
" obj_description(a.oid) as
\"
Description
\"\n
"
"FROM pg_aggregate a, pg_type t
\n
"
"WHERE a.aggbasetype = t.oid
\n
"
);
" obj_description(a.oid) as
\"
Description
\"\n
"
"FROM pg_aggregate a, pg_type t
\n
"
"WHERE a.aggbasetype = t.oid
\n
"
);
if
(
name
)
{
...
...
@@ -64,10 +64,10 @@ describeAggregates(const char *name)
strcat
(
buf
,
"UNION
\n
"
"SELECT a.aggname AS
\"
Name
\"
, '(all types)' as
\"
Type
\"
,
\n
"
" obj_description(a.oid) as
\"
Description
\"\n
"
" obj_description(a.oid) as
\"
Description
\"\n
"
"FROM pg_aggregate a
\n
"
"WHERE a.aggbasetype = 0
\n
"
);
"WHERE a.aggbasetype = 0
\n
"
);
if
(
name
)
{
...
...
@@ -107,11 +107,11 @@ describeFunctions(const char *name, bool verbose)
* arguments, but have no types defined for those arguments
*/
strcpy
(
buf
,
"SELECT t.typname as
\"
Result
\"
, p.proname as
\"
Function
\"
,
\n
"
"SELECT t.typname as
\"
Result
\"
, p.proname as
\"
Function
\"
,
\n
"
" oidvectortypes(p.proargtypes) as
\"
Arguments
\"
"
);
if
(
verbose
)
strcat
(
buf
,
",
\n
u.usename as
\"
Owner
\"
, l.lanname as
\"
Language
\"
, p.prosrc as
\"
Source
\"
,
\n
"
" obj_description(p.oid) as
\"
Description
\"
"
);
" obj_description(p.oid) as
\"
Description
\"
"
);
if
(
!
verbose
)
strcat
(
buf
,
...
...
@@ -159,7 +159,7 @@ describeTypes(const char *name, bool verbose)
strcpy
(
buf
,
"SELECT t.typname AS
\"
Type
\"
"
);
if
(
verbose
)
strcat
(
buf
,
",
\n
(CASE WHEN t.typlen = -1 THEN 'var'::text ELSE t.typlen::text END) as
\"
Size
\"
"
);
strcat
(
buf
,
",
\n
(CASE WHEN t.typlen = -1 THEN 'var'::text ELSE t.typlen::text END) as
\"
Size
\"
"
);
strcat
(
buf
,
",
\n
obj_description(t.oid) as
\"
Description
\"
"
);
/*
* do not include array types (start with underscore),
...
...
@@ -200,12 +200,12 @@ describeOperators(const char *name)
printQueryOpt
myopt
=
pset
.
popt
;
strcpy
(
buf
,
"SELECT o.oprname AS
\"
Op
\"
,
\n
"
"SELECT o.oprname AS
\"
Op
\"
,
\n
"
" t1.typname AS
\"
Left arg
\"
,
\n
"
" t2.typname AS
\"
Right arg
\"
,
\n
"
" t0.typname AS
\"
Result
\"
,
\n
"
" obj_description(p.oid) as
\"
Description
\"\n
"
"FROM pg_proc p, pg_type t0,
\n
"
"FROM pg_proc p, pg_type t0,
\n
"
" pg_type t1, pg_type t2,
\n
"
" pg_operator o
\n
"
"WHERE p.prorettype = t0.oid AND
\n
"
...
...
@@ -225,8 +225,8 @@ describeOperators(const char *name)
" ''::name AS
\"
Left arg
\"
,
\n
"
" t1.typname AS
\"
Right arg
\"
,
\n
"
" t0.typname AS
\"
Result
\"
,
\n
"
" obj_description(p.oid) as
\"
Description
\"\n
"
"FROM pg_operator o, pg_proc p, pg_type t0, pg_type t1
\n
"
" obj_description(p.oid) as
\"
Description
\"\n
"
"FROM pg_operator o, pg_proc p, pg_type t0, pg_type t1
\n
"
"WHERE RegprocToOid(o.oprcode) = p.oid AND
\n
"
" o.oprresult = t0.oid AND
\n
"
" o.oprkind = 'l' AND
\n
"
...
...
@@ -243,8 +243,8 @@ describeOperators(const char *name)
" t1.typname AS
\"
Left arg
\"
,
\n
"
" ''::name AS
\"
Right arg
\"
,
\n
"
" t0.typname AS
\"
Result
\"
,
\n
"
" obj_description(p.oid) as
\"
Description
\"\n
"
"FROM pg_operator o, pg_proc p, pg_type t0, pg_type t1
\n
"
" obj_description(p.oid) as
\"
Description
\"\n
"
"FROM pg_operator o, pg_proc p, pg_type t0, pg_type t1
\n
"
"WHERE RegprocToOid(o.oprcode) = p.oid AND
\n
"
" o.oprresult = t0.oid AND
\n
"
" o.oprkind = 'r' AND
\n
"
...
...
@@ -284,7 +284,7 @@ listAllDbs(bool desc)
printQueryOpt
myopt
=
pset
.
popt
;
strcpy
(
buf
,
"SELECT pg_database.datname as
\"
Database
\"
,
\n
"
"SELECT pg_database.datname as
\"
Database
\"
,
\n
"
" pg_user.usename as
\"
Owner
\"
"
);
#ifdef MULTIBYTE
strcat
(
buf
,
...
...
@@ -299,7 +299,7 @@ listAllDbs(bool desc)
strcat
(
buf
,
"
\n
UNION
\n\n
"
);
strcat
(
buf
,
"SELECT pg_database.datname as
\"
Database
\"
,
\n
"
"SELECT pg_database.datname as
\"
Database
\"
,
\n
"
" NULL as
\"
Owner
\"
"
);
#ifdef MULTIBYTE
strcat
(
buf
,
...
...
@@ -346,7 +346,7 @@ permissionsList(const char *name)
" relname !~ '^pg_'
\n
"
);
if
(
name
)
{
strcat
(
descbuf
,
" AND rename ~ '"
);
strcat
(
descbuf
,
" AND re
l
name ~ '"
);
strncat
(
descbuf
,
name
,
REGEXP_CUTOFF
);
strcat
(
descbuf
,
"'
\n
"
);
}
...
...
@@ -867,7 +867,7 @@ describeTableDetails(const char *name, bool desc)
}
if
(
!
error
)
printTable
(
title
,
headers
,
(
const
char
**
)
cells
,
(
const
char
**
)
footers
,
"llll"
,
&
myopt
,
pset
.
queryFout
);
printTable
(
title
,
headers
,
(
const
char
**
)
cells
,
(
const
char
**
)
footers
,
"llll"
,
&
myopt
,
pset
.
queryFout
);
/* clean up */
free
(
title
);
...
...
@@ -940,14 +940,14 @@ listTables(const char *infotype, const char *name, bool desc)
strcat
(
buf
,
"'
\n
"
);
}
strcat
(
buf
,
"UNION
\n
"
);
strcat
(
buf
,
"UNION
\n
"
);
strcat
(
buf
,
"SELECT c.relname as
\"
Name
\"
, 'table'::text as
\"
Type
\"
, NULL as
\"
Owner
\"
"
);
if
(
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
"
);
" 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
)
{
...
...
@@ -977,14 +977,14 @@ listTables(const char *infotype, const char *name, bool desc)
strcat
(
buf
,
"'
\n
"
);
}
strcat
(
buf
,
"UNION
\n
"
);
strcat
(
buf
,
"UNION
\n
"
);
strcat
(
buf
,
"SELECT c.relname as
\"
Name
\"
, 'view'::text as
\"
Type
\"
, NULL as
\"
Owner
\"
"
);
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
"
" AND not exists (select 1 from pg_user where usesysid = c.relowner)
\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
)
{
...
...
@@ -1029,7 +1029,7 @@ listTables(const char *infotype, const char *name, bool desc)
strcat
(
buf
,
"'
\n
"
);
}
strcat
(
buf
,
"UNION
\n
"
);
strcat
(
buf
,
"UNION
\n
"
);
strcat
(
buf
,
"SELECT c.relname as
\"
Name
\"
,
\n
"
" (CASE WHEN relkind = 'S' THEN 'sequence'::text ELSE 'index'::text END) as
\"
Type
\"
,
\n
"
...
...
@@ -1078,13 +1078,13 @@ listTables(const char *infotype, const char *name, bool desc)
strcat
(
buf
,
"'
\n
"
);
}
strcat
(
buf
,
"UNION
\n
"
);
strcat
(
buf
,
"UNION
\n
"
);
strcat
(
buf
,
"SELECT c.relname as
\"
Name
\"
, 'special'::text as
\"
Type
\"
, NULL as
\"
Owner
\"
"
);
if
(
desc
)
strcat
(
buf
,
", obj_description(c.oid) as
\"
Description
\"
"
);
strcat
(
buf
,
"
\n
FROM pg_class c
\n
"
"WHERE c.relkind = 's'
\n
"
" AND not exists (select 1 from pg_user where usesysid = c.relowner)"
);
" AND not exists (select 1 from pg_user where usesysid = c.relowner)"
);
if
(
name
)
{
strcat
(
buf
,
" AND c.relname ~ '"
);
...
...
@@ -1102,10 +1102,10 @@ listTables(const char *infotype, const char *name, bool desc)
if
(
PQntuples
(
res
)
==
0
&&
!
QUIET
())
{
if
(
name
)
fprintf
(
pset
.
queryFout
,
"No matching relations found.
\n
"
);
else
fprintf
(
pset
.
queryFout
,
"No relations found.
\n
"
);
if
(
name
)
fprintf
(
pset
.
queryFout
,
"No matching relations found.
\n
"
);
else
fprintf
(
pset
.
queryFout
,
"No relations found.
\n
"
);
}
else
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录