Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
c7793a73
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,发现更多精彩内容 >>
提交
c7793a73
编写于
7月 27, 2000
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Ensure that values stored within arrays are not toasted, per
discussion on pghackers a few days ago.
上级
18f13826
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
29 addition
and
6 deletion
+29
-6
src/backend/utils/adt/arrayfuncs.c
src/backend/utils/adt/arrayfuncs.c
+29
-6
未找到文件。
src/backend/utils/adt/arrayfuncs.c
浏览文件 @
c7793a73
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.6
3 2000/07/23 01:35:58
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.6
4 2000/07/27 03:50:52
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -33,6 +33,12 @@
* <dim_lower> - lower boundary of each dimension
* <actual data> - whatever is the stored data
* The actual data starts on a MAXALIGN boundary.
*
* NOTE: it is important that array elements of toastable datatypes NOT be
* toasted, since the tupletoaster won't know they are there. (We could
* support compressed toasted items; only out-of-line items are dangerous.
* However, it seems preferable to store such items uncompressed and allow
* the toaster to compress the whole array as one input.)
*/
...
...
@@ -459,6 +465,8 @@ ReadArrayStr(char *arrayStr,
{
if
(
values
[
i
]
!=
(
Datum
)
0
)
{
/* let's just make sure data is not toasted */
values
[
i
]
=
PointerGetDatum
(
PG_DETOAST_DATUM
(
values
[
i
]));
if
(
typalign
==
'd'
)
*
nbytes
+=
MAXALIGN
(
VARSIZE
(
DatumGetPointer
(
values
[
i
])));
else
...
...
@@ -485,6 +493,10 @@ ReadArrayStr(char *arrayStr,
* typbyval, typlen, typalign: info about element datatype
* freedata: if TRUE and element type is pass-by-ref, pfree data values
* referenced by Datums after copying them.
*
* If the input data is of varlena type, the caller must have ensured that
* the values are not toasted. (Doing it here doesn't work since the
* caller has already allocated space for the array...)
*----------
*/
static
void
...
...
@@ -961,6 +973,10 @@ array_set(ArrayType *array,
return
newarray
;
}
/* make sure item to be inserted is not toasted */
if
(
elmlen
<
0
)
dataValue
=
PointerGetDatum
(
PG_DETOAST_DATUM
(
dataValue
));
/* detoast input if necessary */
array
=
DatumGetArrayTypeP
(
PointerGetDatum
(
array
));
...
...
@@ -1120,6 +1136,8 @@ array_set_slice(ArrayType *array,
array
=
DatumGetArrayTypeP
(
PointerGetDatum
(
array
));
srcArray
=
DatumGetArrayTypeP
(
PointerGetDatum
(
srcArray
));
/* note: we assume srcArray contains no toasted elements */
ndim
=
ARR_NDIM
(
array
);
if
(
ndim
!=
nSubscripts
||
ndim
<=
0
||
ndim
>
MAXDIM
)
elog
(
ERROR
,
"Invalid array subscripts"
);
...
...
@@ -1368,12 +1386,14 @@ array_map(FunctionCallInfo fcinfo, Oid inpType, Oid retType)
if
(
fcinfo
->
isnull
)
elog
(
ERROR
,
"array_map: cannot handle NULL in array"
);
/*
U
pdate total result size */
if
(
typbyval
)
/*
Ensure data is not toasted, and u
pdate total result size */
if
(
typbyval
||
typlen
>
0
)
nbytes
+=
typlen
;
else
nbytes
+=
((
typlen
>
0
)
?
typlen
:
INTALIGN
(
VARSIZE
(
DatumGetPointer
(
values
[
i
]))));
{
values
[
i
]
=
PointerGetDatum
(
PG_DETOAST_DATUM
(
values
[
i
]));
nbytes
+=
INTALIGN
(
VARSIZE
(
DatumGetPointer
(
values
[
i
])));
}
}
/* Allocate and initialize the result array */
...
...
@@ -1420,10 +1440,13 @@ construct_array(Datum *elems, int nelems,
}
else
{
/* varlena type */
/* varlena type
... make sure it is untoasted
*/
nbytes
=
0
;
for
(
i
=
0
;
i
<
nelems
;
i
++
)
{
elems
[
i
]
=
PointerGetDatum
(
PG_DETOAST_DATUM
(
elems
[
i
]));
nbytes
+=
INTALIGN
(
VARSIZE
(
DatumGetPointer
(
elems
[
i
])));
}
}
/* Allocate and initialize 1-D result array */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录