Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
dd9af92c
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,发现更多精彩内容 >>
提交
dd9af92c
编写于
5月 18, 2002
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add display of sort keys to the default EXPLAIN output.
上级
a5b37094
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
87 addition
and
4 deletion
+87
-4
src/backend/commands/explain.c
src/backend/commands/explain.c
+63
-2
src/backend/utils/adt/ruleutils.c
src/backend/utils/adt/ruleutils.c
+22
-1
src/include/utils/builtins.h
src/include/utils/builtins.h
+2
-1
未找到文件。
src/backend/commands/explain.c
浏览文件 @
dd9af92c
...
...
@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994-5, Regents of the University of California
*
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.7
7 2002/05/12 20:10:02
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.7
8 2002/05/18 21:38:40
tgl Exp $
*
*/
...
...
@@ -56,6 +56,8 @@ static void show_upper_qual(List *qual, const char *qlabel,
const
char
*
outer_name
,
int
outer_varno
,
Plan
*
outer_plan
,
const
char
*
inner_name
,
int
inner_varno
,
Plan
*
inner_plan
,
StringInfo
str
,
int
indent
,
ExplainState
*
es
);
static
void
show_sort_keys
(
List
*
tlist
,
int
nkeys
,
const
char
*
qlabel
,
StringInfo
str
,
int
indent
,
ExplainState
*
es
);
static
Node
*
make_ors_ands_explicit
(
List
*
orclauses
);
static
TextOutputState
*
begin_text_output
(
CommandDest
dest
,
char
*
title
);
static
void
do_text_output
(
TextOutputState
*
tstate
,
char
*
aline
);
...
...
@@ -410,7 +412,7 @@ explain_outNode(StringInfo str, Plan *plan, Plan *outer_plan,
}
appendStringInfo
(
str
,
"
\n
"
);
/* quals */
/* quals
, sort keys, etc
*/
switch
(
nodeTag
(
plan
))
{
case
T_IndexScan
:
...
...
@@ -495,6 +497,11 @@ explain_outNode(StringInfo str, Plan *plan, Plan *outer_plan,
""
,
0
,
NULL
,
str
,
indent
,
es
);
break
;
case
T_Sort
:
show_sort_keys
(
plan
->
targetlist
,
((
Sort
*
)
plan
)
->
keycount
,
"Sort Key"
,
str
,
indent
,
es
);
break
;
case
T_Result
:
show_upper_qual
((
List
*
)
((
Result
*
)
plan
)
->
resconstantqual
,
"One-Time Filter"
,
...
...
@@ -731,6 +738,60 @@ show_upper_qual(List *qual, const char *qlabel,
appendStringInfo
(
str
,
" %s: %s
\n
"
,
qlabel
,
exprstr
);
}
/*
* Show the sort keys for a Sort node.
*/
static
void
show_sort_keys
(
List
*
tlist
,
int
nkeys
,
const
char
*
qlabel
,
StringInfo
str
,
int
indent
,
ExplainState
*
es
)
{
List
*
context
;
bool
useprefix
;
int
keyno
;
List
*
tl
;
char
*
exprstr
;
int
i
;
if
(
nkeys
<=
0
)
return
;
for
(
i
=
0
;
i
<
indent
;
i
++
)
appendStringInfo
(
str
,
" "
);
appendStringInfo
(
str
,
" %s: "
,
qlabel
);
/*
* In this routine we expect that the plan node's tlist has not been
* processed by set_plan_references(), so any Vars will contain valid
* varnos referencing the actual rtable.
*/
context
=
deparse_context_from_rtable
(
es
->
rtable
);
useprefix
=
length
(
es
->
rtable
)
>
1
;
for
(
keyno
=
1
;
keyno
<=
nkeys
;
keyno
++
)
{
/* find key expression in tlist */
foreach
(
tl
,
tlist
)
{
TargetEntry
*
target
=
(
TargetEntry
*
)
lfirst
(
tl
);
if
(
target
->
resdom
->
reskey
==
keyno
)
{
/* Deparse the expression */
exprstr
=
deparse_expression
(
target
->
expr
,
context
,
useprefix
);
/* And add to str */
if
(
keyno
>
1
)
appendStringInfo
(
str
,
", "
);
appendStringInfo
(
str
,
"%s"
,
exprstr
);
break
;
}
}
if
(
tl
==
NIL
)
elog
(
ERROR
,
"show_sort_keys: no tlist entry for key %d"
,
keyno
);
}
appendStringInfo
(
str
,
"
\n
"
);
}
/*
* Indexscan qual lists have an implicit OR-of-ANDs structure. Make it
* explicit so deparsing works properly.
...
...
src/backend/utils/adt/ruleutils.c
浏览文件 @
dd9af92c
...
...
@@ -3,7 +3,7 @@
* back to source text
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.10
5 2002/05/17 01:19:18
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.10
6 2002/05/18 21:38:40
tgl Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
...
...
@@ -779,6 +779,27 @@ deparse_context_for_subplan(const char *name, List *tlist,
return
(
Node
*
)
rte
;
}
/*
* deparse_context_from_rtable - Build deparse context given a rangetable
*
* This is suitable for deparsing expressions that refer to only a single
* level of variables (no outer-reference Vars).
*/
List
*
deparse_context_from_rtable
(
List
*
rtable
)
{
deparse_namespace
*
dpns
;
dpns
=
(
deparse_namespace
*
)
palloc
(
sizeof
(
deparse_namespace
));
dpns
->
rtable
=
rtable
;
dpns
->
outer_varno
=
dpns
->
inner_varno
=
0
;
dpns
->
outer_rte
=
dpns
->
inner_rte
=
NULL
;
/* Return a one-deep namespace stack */
return
makeList1
(
dpns
);
}
/* ----------
* make_ruledef - reconstruct the CREATE RULE command
* for a given pg_rewrite tuple
...
...
src/include/utils/builtins.h
浏览文件 @
dd9af92c
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: builtins.h,v 1.18
1 2002/05/12 20:10:05
tgl Exp $
* $Id: builtins.h,v 1.18
2 2002/05/18 21:38:41
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -357,6 +357,7 @@ extern List *deparse_context_for_plan(int outer_varno, Node *outercontext,
extern
Node
*
deparse_context_for_rte
(
RangeTblEntry
*
rte
);
extern
Node
*
deparse_context_for_subplan
(
const
char
*
name
,
List
*
tlist
,
List
*
rtable
);
extern
List
*
deparse_context_from_rtable
(
List
*
rtable
);
extern
const
char
*
quote_identifier
(
const
char
*
ident
);
extern
char
*
quote_qualified_identifier
(
const
char
*
namespace
,
const
char
*
ident
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录