Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
40136f44
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,发现更多精彩内容 >>
提交
40136f44
编写于
4月 18, 2001
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make rule lister do the right thing with Vars representing whole tuples.
上级
4a590518
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
29 addition
and
10 deletion
+29
-10
src/backend/parser/parse_relation.c
src/backend/parser/parse_relation.c
+7
-1
src/backend/utils/adt/ruleutils.c
src/backend/utils/adt/ruleutils.c
+22
-9
未找到文件。
src/backend/parser/parse_relation.c
浏览文件 @
40136f44
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.5
3 2001/03/22 03:59:41 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.5
4 2001/04/18 17:04:24 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -909,6 +909,9 @@ expandNamesVars(ParseState *pstate, List *names, List *vars)
* In particular, it will work on an RTE for a subselect, whereas
* get_attname() only works on real relations.
*
* "*" is returned if the given attnum is InvalidAttrNumber --- this case
* occurs when a Var represents a whole tuple of a relation.
*
* XXX Actually, this is completely bogus, because refnames of RTEs are
* not guaranteed unique, and may not even have scope across the whole
* query. Cleanest fix would be to add refname/attname to Var nodes and
...
...
@@ -920,6 +923,9 @@ get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum)
{
char
*
attname
;
if
(
attnum
==
InvalidAttrNumber
)
return
"*"
;
/*
* If there is an alias, use it
*/
...
...
src/backend/utils/adt/ruleutils.c
浏览文件 @
40136f44
...
...
@@ -3,7 +3,7 @@
* back to source text
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.7
6 2001/04/15 03:14:18
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.7
7 2001/04/18 17:04:24
tgl Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
...
...
@@ -1051,7 +1051,8 @@ get_basic_select_query(Query *query, deparse_context *context)
char
*
attname
;
get_names_for_var
(
var
,
context
,
&
refname
,
&
attname
);
tell_as
=
(
strcmp
(
attname
,
tle
->
resdom
->
resname
)
!=
0
);
tell_as
=
(
attname
==
NULL
||
strcmp
(
attname
,
tle
->
resdom
->
resname
)
!=
0
);
}
/* and do if so */
...
...
@@ -1380,6 +1381,9 @@ get_utility_query_def(Query *query, deparse_context *context)
/*
* Get the relation refname and attname for a (possibly nonlocal) Var.
*
* attname will be returned as NULL if the Var represents a whole tuple
* of the relation.
*
* This is trickier than it ought to be because of the possibility of aliases
* and limited scope of refnames. We have to try to return the correct alias
* with respect to the current namespace given by the context.
...
...
@@ -1414,7 +1418,10 @@ get_names_for_var(Var *var, deparse_context *context,
*/
rte
=
rt_fetch
(
var
->
varno
,
dpns
->
rtable
);
*
refname
=
rte
->
eref
->
relname
;
*
attname
=
get_rte_attribute_name
(
rte
,
var
->
varattno
);
if
(
var
->
varattno
==
InvalidAttrNumber
)
*
attname
=
NULL
;
else
*
attname
=
get_rte_attribute_name
(
rte
,
var
->
varattno
);
}
/*
...
...
@@ -1474,7 +1481,10 @@ find_alias_in_namespace(Node *nsnode, Node *expr,
RangeTblEntry
*
rte
=
rt_fetch
(
rtindex
,
rangetable
);
*
refname
=
rte
->
eref
->
relname
;
*
attname
=
get_rte_attribute_name
(
rte
,
var
->
varattno
);
if
(
var
->
varattno
==
InvalidAttrNumber
)
*
attname
=
NULL
;
else
*
attname
=
get_rte_attribute_name
(
rte
,
var
->
varattno
);
return
true
;
}
}
...
...
@@ -1684,17 +1694,20 @@ get_rule_expr(Node *node, deparse_context *context)
char
*
attname
;
get_names_for_var
(
var
,
context
,
&
refname
,
&
attname
);
if
(
context
->
varprefix
)
if
(
context
->
varprefix
||
attname
==
NULL
)
{
if
(
strcmp
(
refname
,
"*NEW*"
)
==
0
)
appendStringInfo
(
buf
,
"new
.
"
);
appendStringInfo
(
buf
,
"new"
);
else
if
(
strcmp
(
refname
,
"*OLD*"
)
==
0
)
appendStringInfo
(
buf
,
"old
.
"
);
appendStringInfo
(
buf
,
"old"
);
else
appendStringInfo
(
buf
,
"%s
.
"
,
appendStringInfo
(
buf
,
"%s"
,
quote_identifier
(
refname
));
if
(
attname
)
appendStringInfoChar
(
buf
,
'.'
);
}
appendStringInfo
(
buf
,
"%s"
,
quote_identifier
(
attname
));
if
(
attname
)
appendStringInfo
(
buf
,
"%s"
,
quote_identifier
(
attname
));
}
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录