Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
e4eb9104
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,发现更多精彩内容 >>
提交
e4eb9104
编写于
12月 18, 2000
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Document the array_dims() function, and make some other small improvements
in the docs for arrays.
上级
1f159e56
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
45 addition
and
18 deletion
+45
-18
doc/src/sgml/advanced.sgml
doc/src/sgml/advanced.sgml
+5
-4
doc/src/sgml/array.sgml
doc/src/sgml/array.sgml
+35
-7
doc/src/sgml/syntax.sgml
doc/src/sgml/syntax.sgml
+5
-7
未找到文件。
doc/src/sgml/advanced.sgml
浏览文件 @
e4eb9104
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/advanced.sgml,v 1.1
6 2000/09/29 20:21:33 petere
Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/advanced.sgml,v 1.1
7 2000/12/18 23:39:37 tgl
Exp $
-->
<chapter id="advanced">
...
...
@@ -178,7 +178,7 @@ CREATE TABLE SAL_EMP (
salary by quarter and a two-dimensional array of
<firstterm>text</firstterm>
(schedule), which represents the employee's weekly
schedule. Now we do some <firstterm>INSERT
S
</firstterm>s;
schedule. Now we do some <firstterm>INSERT</firstterm>s;
note that when
appending to an array, we enclose the values within
braces and separate them by commas. If you know
...
...
@@ -239,8 +239,9 @@ SELECT SAL_EMP.pay_by_quarter[3] FROM SAL_EMP;
</para>
<para>
We can also access arbitrary slices of an array, or
subarrays. This query retrieves the first item on
We can also access arbitrary slices of an array (subarrays)
by specifying both lower and upper bounds for
each subscript. This query retrieves the first item on
Bill's schedule for the first two days of the week.
<programlisting>
...
...
doc/src/sgml/array.sgml
浏览文件 @
e4eb9104
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/array.sgml,v 1.8 2000/12/18 23:39:37 tgl Exp $
-->
<Chapter Id="arrays">
<Title>Arrays</Title>
...
...
@@ -30,7 +34,7 @@ CREATE TABLE sal_emp (
(pay_by_quarter), which represents the employee's
salary by quarter, and a two-dimensional array of <FirstTerm>text</FirstTerm>
(schedule), which represents the employee's weekly
schedule. Now we do some <FirstTerm>INSERT
S
</FirstTerm>s; note that when
schedule. Now we do some <FirstTerm>INSERT</FirstTerm>s; note that when
appending to an array, we enclose the values within
braces and separate them by commas. If you know <FirstTerm>C</FirstTerm>,
this is not unlike the syntax for initializing structures.
...
...
@@ -82,9 +86,10 @@ SELECT pay_by_quarter[3] FROM sal_emp;
</Para>
<Para>
We can also access arbitrary slices of an array, or
We can also access arbitrary
rectangular
slices of an array, or
subarrays. An array slice is denoted by writing
"lower subscript : upper subscript" for one or more array
<replaceable>lower subscript</replaceable> <literal>:</literal>
<replaceable>upper subscript</replaceable> for one or more array
dimensions. This query retrieves the first item on
Bill's schedule for the first two days of the week:
...
...
@@ -103,7 +108,11 @@ SELECT schedule[1:2][1:1] FROM sal_emp WHERE name = 'Bill';
SELECT schedule[1:2][1] FROM sal_emp WHERE name = 'Bill';
</ProgramListing>
with the same result.
with the same result. An array subscripting operation is taken to
represent an array slice if any of the subscripts are written in
the form <replaceable>lower</replaceable> <literal>:</literal>
<replaceable>upper</replaceable>. A lower bound of 1 is assumed
for any subscript where only one value is specified.
</Para>
<Para>
...
...
@@ -114,7 +123,7 @@ UPDATE sal_emp SET pay_by_quarter = '{25000,25000,27000,27000}'
WHERE name = 'Carol';
</ProgramListing>
or updated at a single e
ntry
:
or updated at a single e
lement
:
<ProgramListing>
UPDATE sal_emp SET pay_by_quarter[4] = 15000
...
...
@@ -132,10 +141,11 @@ UPDATE sal_emp SET pay_by_quarter[1:2] = '{27000,27000}'
<Para>
An array can be enlarged by assigning to an element adjacent to
those already present, or by assigning to a slice that is adjacent
to or overlaps the data already present. Currently, this is only
allowed for one-dimensional arrays, not multidimensional arrays.
to or overlaps the data already present.
For example, if an array value currently has 4 elements, it will
have five elements after an update that assigns to array[5].
Currently, enlargement in this fashion is only
allowed for one-dimensional arrays, not multidimensional arrays.
</Para>
<Para>
...
...
@@ -160,4 +170,22 @@ CREATE TABLE tictactoe (
number of dimensions.
</Para>
<Para>
The current dimensions of any array value can be retrieved with
the <function>array_dims</function> function:
<ProgramListing>
SELECT array_dims(schedule) FROM sal_emp WHERE name = 'Carol';
array_dims
------------
[1:2][1:1]
(1 row)
</ProgramListing>
<function>array_dims</function> produces a <type>text</type> result,
which is convenient for people to read but perhaps not so convenient
for programs.
</Para>
</Chapter>
doc/src/sgml/syntax.sgml
浏览文件 @
e4eb9104
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.2
8 2000/12/17 05:47:5
7 tgl Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.2
9 2000/12/18 23:39:3
7 tgl Exp $
-->
<chapter id="syntax">
...
...
@@ -555,12 +555,10 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
</para>
<para>
Individual array elements can be placed between single-quote
marks to avoid ambiguity problems with respect to leading white space.
Without quote marks, the array-value parser will skip white space.
Note that to write a quote mark inside a string literal that is to
become an array value, you must double the quote mark as described
previously.
Individual array elements can be placed between double-quote
marks (<literal>"</literal>) to avoid ambiguity problems with respect to
white space.
Without quote marks, the array-value parser will skip leading white space.
</para>
</sect2>
</sect1>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录