1
1
<!--
2
- $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.108 2002/08/06 05:40:44 ishii Exp $
2
+ $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.109 2002/08/08 14:29:07 tgl Exp $
3
3
PostgreSQL documentation
4
4
-->
5
5
@@ -3868,7 +3868,7 @@ SELECT TIMESTAMP 'now';
3868
3868
</row>
3869
3869
<row>
3870
3870
<entry> # </entry>
3871
- <entry>Number of points in polygon</entry>
3871
+ <entry>Number of points in path or polygon</entry>
3872
3872
<entry><literal># '((1,0),(0,1),(-1,0))'</literal></entry>
3873
3873
</row>
3874
3874
<row>
@@ -4025,6 +4025,18 @@ SELECT TIMESTAMP 'now';
4025
4025
<entry>length of item</entry>
4026
4026
<entry><literal>length(path '((-1,0),(1,0))')</literal></entry>
4027
4027
</row>
4028
+ <row>
4029
+ <entry><function>npoints</function>(path)</entry>
4030
+ <entry><type>integer</type></entry>
4031
+ <entry>number of points</entry>
4032
+ <entry><literal>npoints(path '[(0,0),(1,1),(2,0)]')</literal></entry>
4033
+ </row>
4034
+ <row>
4035
+ <entry><function>npoints</function>(polygon)</entry>
4036
+ <entry><type>integer</type></entry>
4037
+ <entry>number of points</entry>
4038
+ <entry><literal>npoints(polygon '((1,1),(0,0))')</literal></entry>
4039
+ </row>
4028
4040
<row>
4029
4041
<entry><function>pclose</function>(path)</entry>
4030
4042
<entry><type>path</type></entry>
@@ -4040,12 +4052,6 @@ SELECT TIMESTAMP 'now';
4040
4052
<entry><literal>point(lseg '((-1,0),(1,0))',lseg '((-2,-2),(2,2))')</literal></entry>
4041
4053
</row>
4042
4054
]]>
4043
- <row>
4044
- <entry><function>npoint</function>(path)</entry>
4045
- <entry><type>integer</type></entry>
4046
- <entry>number of points</entry>
4047
- <entry><literal>npoints(path '[(0,0),(1,1),(2,0)]')</literal></entry>
4048
- </row>
4049
4055
<row>
4050
4056
<entry><function>popen</function>(path)</entry>
4051
4057
<entry><type>path</type></entry>
@@ -4150,7 +4156,7 @@ SELECT TIMESTAMP 'now';
4150
4156
<row>
4151
4157
<entry><function>polygon</function>(<type>box</type>)</entry>
4152
4158
<entry><type>polygon</type></entry>
4153
- <entry>12 point polygon</entry>
4159
+ <entry>4- point polygon</entry>
4154
4160
<entry><literal>polygon(box '((0,0),(1,1))')</literal></entry>
4155
4161
</row>
4156
4162
<row>
@@ -4175,6 +4181,16 @@ SELECT TIMESTAMP 'now';
4175
4181
</tgroup>
4176
4182
</table>
4177
4183
4184
+ <para>
4185
+ It is possible to access the two component numbers of a <type>point</>
4186
+ as though it were an array with subscripts 0,1. For example, if
4187
+ <literal>t.p</> is a <type>point</> column then
4188
+ <literal>SELECT p[0] FROM t</> retrieves the X coordinate;
4189
+ <literal>UPDATE t SET p[1] = ...</> changes the Y coordinate.
4190
+ In the same way, a <type>box</> or an <type>lseg</> may be treated
4191
+ as an array of two <type>point</>s.
4192
+ </para>
4193
+
4178
4194
</sect1>
4179
4195
4180
4196
0 commit comments