Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
bf3e6753
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,发现更多精彩内容 >>
提交
bf3e6753
编写于
2月 24, 2003
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Avoid using a separate query to fetch the default expressions for
columns. Improved version of patch by mallah@trade-india.com.
上级
0797bb5c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
9 addition
and
19 deletion
+9
-19
src/bin/psql/describe.c
src/bin/psql/describe.c
+9
-19
未找到文件。
src/bin/psql/describe.c
浏览文件 @
bf3e6753
...
...
@@ -3,7 +3,7 @@
*
* Copyright 2000-2002 by PostgreSQL Global Development Group
*
* $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.7
4 2003/01/07 20:56
:06 tgl Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.7
5 2003/02/24 03:54
:06 tgl Exp $
*/
#include "postgres_fe.h"
#include "describe.h"
...
...
@@ -715,8 +715,10 @@ describeOneTableDetails(const char *schemaname,
printfPQExpBuffer
(
&
buf
,
"SELECT
\n
CASE i.indproc WHEN ('-'::pg_catalog.regproc) THEN a.attname
\n
ELSE SUBSTR(pg_catalog.pg_get_indexdef(attrelid),
\n
POSITION('(' in pg_catalog.pg_get_indexdef(attrelid)))
\n
END,"
);
else
printfPQExpBuffer
(
&
buf
,
"SELECT a.attname,"
);
appendPQExpBuffer
(
&
buf
,
"
\n
pg_catalog.format_type(a.atttypid, a.atttypmod),
\n
"
" a.attnotnull, a.atthasdef, a.attnum"
);
appendPQExpBuffer
(
&
buf
,
"
\n
pg_catalog.format_type(a.atttypid, a.atttypmod),"
"
\n
(SELECT substring(d.adsrc for 128) FROM pg_catalog.pg_attrdef d"
"
\n
WHERE d.adrelid = a.attrelid AND d.adnum = a.attnum AND a.atthasdef),"
"
\n
a.attnotnull, a.attnum"
);
if
(
verbose
)
appendPQExpBuffer
(
&
buf
,
", pg_catalog.col_description(a.attrelid, a.attnum)"
);
appendPQExpBuffer
(
&
buf
,
"
\n
FROM pg_catalog.pg_attribute a"
);
...
...
@@ -762,32 +764,20 @@ describeOneTableDetails(const char *schemaname,
* either */
/* Extra: not null and default */
/* (I'm cutting off the 'default' string at 128) */
if
(
show_modifiers
)
{
resetPQExpBuffer
(
&
tmpbuf
);
if
(
strcmp
(
PQgetvalue
(
res
,
i
,
2
),
"t"
)
==
0
)
if
(
strcmp
(
PQgetvalue
(
res
,
i
,
3
),
"t"
)
==
0
)
appendPQExpBufferStr
(
&
tmpbuf
,
"not null"
);
/* handle "default" here */
if
(
strcmp
(
PQgetvalue
(
res
,
i
,
3
),
"t"
)
==
0
)
/* (note: above we cut off the 'default' string at 128) */
if
(
strlen
(
PQgetvalue
(
res
,
i
,
2
))
!=
0
)
{
PGresult
*
result
;
printfPQExpBuffer
(
&
buf
,
"SELECT substring(d.adsrc for 128) FROM pg_catalog.pg_attrdef d
\n
"
"WHERE d.adrelid = '%s' AND d.adnum = %s"
,
oid
,
PQgetvalue
(
res
,
i
,
4
));
result
=
PSQLexec
(
buf
.
data
,
false
);
if
(
tmpbuf
.
len
>
0
)
appendPQExpBufferStr
(
&
tmpbuf
,
" "
);
appendPQExpBuffer
(
&
tmpbuf
,
"default %s"
,
result
?
PQgetvalue
(
result
,
0
,
0
)
:
"?"
);
PQclear
(
result
);
PQgetvalue
(
res
,
i
,
2
));
}
cells
[
i
*
cols
+
2
]
=
xstrdup
(
tmpbuf
.
data
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录