Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
c8bcd5ca
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,发现更多精彩内容 >>
提交
c8bcd5ca
编写于
1月 24, 2004
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix problems with dropped columns in pltcl triggers, per report from Patrick Samson.
上级
0152f148
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
28 addition
and
19 deletion
+28
-19
doc/src/sgml/pltcl.sgml
doc/src/sgml/pltcl.sgml
+5
-2
src/pl/tcl/pltcl.c
src/pl/tcl/pltcl.c
+23
-17
未找到文件。
doc/src/sgml/pltcl.sgml
浏览文件 @
c8bcd5ca
<!--
$PostgreSQL: pgsql/doc/src/sgml/pltcl.sgml,v 2.2
8 2003/11/29 19:51:37 pgsq
l Exp $
$PostgreSQL: pgsql/doc/src/sgml/pltcl.sgml,v 2.2
9 2004/01/24 23:06:29 tg
l Exp $
-->
<chapter id="pltcl">
...
...
@@ -516,7 +516,10 @@ SELECT 'doesn''t' AS ret
element. So looking up a column name in the list with <application>Tcl</>'s
<function>lsearch</> command returns the element's number starting
with 1 for the first column, the same way the columns are customarily
numbered in <productname>PostgreSQL</productname>.
numbered in <productname>PostgreSQL</productname>. (Empty list
elements also appear in the positions of columns that have been
dropped, so that the attribute numbering is correct for columns
to their right.)
</para>
</listitem>
</varlistentry>
...
...
src/pl/tcl/pltcl.c
浏览文件 @
c8bcd5ca
...
...
@@ -31,7 +31,7 @@
* ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/tcl/pltcl.c,v 1.8
1 2004/01/06 23:55:1
9 tgl Exp $
* $PostgreSQL: pgsql/src/pl/tcl/pltcl.c,v 1.8
2 2004/01/24 23:06:2
9 tgl Exp $
*
**********************************************************************/
...
...
@@ -695,11 +695,15 @@ pltcl_trigger_handler(PG_FUNCTION_ARGS)
pfree
(
stroid
);
/* A list of attribute names for argument TG_relatts */
/* note: we deliberately include dropped atts here */
Tcl_DStringAppendElement
(
&
tcl_trigtup
,
""
);
for
(
i
=
0
;
i
<
tupdesc
->
natts
;
i
++
)
Tcl_DStringAppendElement
(
&
tcl_trigtup
,
NameStr
(
tupdesc
->
attrs
[
i
]
->
attname
));
{
if
(
tupdesc
->
attrs
[
i
]
->
attisdropped
)
Tcl_DStringAppendElement
(
&
tcl_trigtup
,
""
);
else
Tcl_DStringAppendElement
(
&
tcl_trigtup
,
NameStr
(
tupdesc
->
attrs
[
i
]
->
attname
));
}
Tcl_DStringAppendElement
(
&
tcl_cmd
,
Tcl_DStringValue
(
&
tcl_trigtup
));
Tcl_DStringFree
(
&
tcl_trigtup
);
Tcl_DStringInit
(
&
tcl_trigtup
);
...
...
@@ -881,9 +885,10 @@ pltcl_trigger_handler(PG_FUNCTION_ARGS)
siglongjmp
(
Warn_restart
,
1
);
}
i
=
0
;
while
(
i
<
ret_numvals
)
for
(
i
=
0
;
i
<
ret_numvals
;
i
+=
2
)
{
CONST84
char
*
ret_name
=
ret_values
[
i
];
CONST84
char
*
ret_value
=
ret_values
[
i
+
1
];
int
attnum
;
HeapTuple
typeTup
;
Oid
typinput
;
...
...
@@ -891,24 +896,25 @@ pltcl_trigger_handler(PG_FUNCTION_ARGS)
FmgrInfo
finfo
;
/************************************************************
* Ignore
pseudo elements with a dot name
* Ignore
".tupno" pseudo elements (see pltcl_set_tuple_values)
************************************************************/
if
(
*
(
ret_values
[
i
])
==
'.'
)
{
i
+=
2
;
if
(
strcmp
(
ret_name
,
".tupno"
)
==
0
)
continue
;
}
/************************************************************
* Get the attribute number
************************************************************/
attnum
=
SPI_fnumber
(
tupdesc
,
ret_
values
[
i
++
]
);
attnum
=
SPI_fnumber
(
tupdesc
,
ret_
name
);
if
(
attnum
==
SPI_ERROR_NOATTRIBUTE
)
elog
(
ERROR
,
"invalid attribute
\"
%s
\"
"
,
ret_values
[
--
i
]);
elog
(
ERROR
,
"invalid attribute
\"
%s
\"
"
,
ret_name
);
if
(
attnum
<=
0
)
elog
(
ERROR
,
"cannot set system attribute
\"
%s
\"
"
,
ret_values
[
--
i
]);
elog
(
ERROR
,
"cannot set system attribute
\"
%s
\"
"
,
ret_name
);
/************************************************************
* Ignore dropped columns
************************************************************/
if
(
tupdesc
->
attrs
[
attnum
-
1
]
->
attisdropped
)
continue
;
/************************************************************
* Lookup the attribute type in the syscache
...
...
@@ -932,7 +938,7 @@ pltcl_trigger_handler(PG_FUNCTION_ARGS)
UTF_BEGIN
;
modvalues
[
attnum
-
1
]
=
FunctionCall3
(
&
finfo
,
CStringGetDatum
(
UTF_U2E
(
ret_value
s
[
i
++
]
)),
CStringGetDatum
(
UTF_U2E
(
ret_value
)),
ObjectIdGetDatum
(
typelem
),
Int32GetDatum
(
tupdesc
->
attrs
[
attnum
-
1
]
->
atttypmod
));
UTF_END
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录