Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
251282d4
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,发现更多精彩内容 >>
提交
251282d4
编写于
3月 20, 2002
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Tweak behavior of array slicing operations: seems like it ought to be
okay to omit low-order dimensions when accessing an array slice.
上级
861c336b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
6 deletion
+25
-6
src/backend/utils/adt/arrayfuncs.c
src/backend/utils/adt/arrayfuncs.c
+25
-6
未找到文件。
src/backend/utils/adt/arrayfuncs.c
浏览文件 @
251282d4
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.7
6 2002/03/16 22:47:13
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.7
7 2002/03/20 19:41:47
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -907,10 +907,10 @@ array_get_slice(ArrayType *array,
* with an empty slice, return NULL (should it be an empty array
* instead?)
*/
if
(
ndim
!=
nSubscripts
||
ndim
<=
0
||
ndim
>
MAXDIM
)
if
(
ndim
<
nSubscripts
||
ndim
<=
0
||
ndim
>
MAXDIM
)
RETURN_NULL
(
ArrayType
*
);
for
(
i
=
0
;
i
<
n
dim
;
i
++
)
for
(
i
=
0
;
i
<
n
Subscripts
;
i
++
)
{
if
(
lowerIndx
[
i
]
<
lb
[
i
])
lowerIndx
[
i
]
=
lb
[
i
];
...
...
@@ -919,8 +919,16 @@ array_get_slice(ArrayType *array,
if
(
lowerIndx
[
i
]
>
upperIndx
[
i
])
RETURN_NULL
(
ArrayType
*
);
}
/* fill any missing subscript positions with full array range */
for
(;
i
<
ndim
;
i
++
)
{
lowerIndx
[
i
]
=
lb
[
i
];
upperIndx
[
i
]
=
dim
[
i
]
+
lb
[
i
]
-
1
;
if
(
lowerIndx
[
i
]
>
upperIndx
[
i
])
RETURN_NULL
(
ArrayType
*
);
}
mda_get_range
(
n
Subscripts
,
span
,
lowerIndx
,
upperIndx
);
mda_get_range
(
n
dim
,
span
,
lowerIndx
,
upperIndx
);
bytes
=
array_slice_size
(
ndim
,
dim
,
lb
,
arraydataptr
,
elmlen
,
lowerIndx
,
upperIndx
);
...
...
@@ -1120,6 +1128,9 @@ array_set(ArrayType *array,
* A new array is returned, just like the old except for the
* modified range.
*
* NOTE: we assume it is OK to scribble on the provided index arrays
* lowerIndx[] and upperIndx[]. These are generally just temporaries.
*
* NOTE: For assignments, we throw an error for silly subscripts etc,
* rather than returning a NULL as the fetch operations do. The reasoning
* is that returning a NULL would cause the user's whole array to be replaced
...
...
@@ -1172,7 +1183,7 @@ array_set_slice(ArrayType *array,
/* note: we assume srcArray contains no toasted elements */
ndim
=
ARR_NDIM
(
array
);
if
(
ndim
!=
nSubscripts
||
ndim
<=
0
||
ndim
>
MAXDIM
)
if
(
ndim
<
nSubscripts
||
ndim
<=
0
||
ndim
>
MAXDIM
)
elog
(
ERROR
,
"Invalid array subscripts"
);
/* copy dim/lb since we may modify them */
...
...
@@ -1185,7 +1196,7 @@ array_set_slice(ArrayType *array,
* extend the array as long as no hole is created. An empty slice is
* an error, too.
*/
for
(
i
=
0
;
i
<
n
dim
;
i
++
)
for
(
i
=
0
;
i
<
n
Subscripts
;
i
++
)
{
if
(
lowerIndx
[
i
]
>
upperIndx
[
i
])
elog
(
ERROR
,
"Invalid array subscripts"
);
...
...
@@ -1207,6 +1218,14 @@ array_set_slice(ArrayType *array,
elog
(
ERROR
,
"Invalid array subscripts"
);
}
}
/* fill any missing subscript positions with full array range */
for
(;
i
<
ndim
;
i
++
)
{
lowerIndx
[
i
]
=
lb
[
i
];
upperIndx
[
i
]
=
dim
[
i
]
+
lb
[
i
]
-
1
;
if
(
lowerIndx
[
i
]
>
upperIndx
[
i
])
elog
(
ERROR
,
"Invalid array subscripts"
);
}
/*
* Make sure source array has enough entries. Note we ignore the
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录