Skip to content

Commit d176fad

Browse files
committed
Some improvements in geometric-operators documentation.
1 parent f840021 commit d176fad

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

doc/src/sgml/func.sgml

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
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 $
33
PostgreSQL documentation
44
-->
55

@@ -3868,7 +3868,7 @@ SELECT TIMESTAMP 'now';
38683868
</row>
38693869
<row>
38703870
<entry> # </entry>
3871-
<entry>Number of points in polygon</entry>
3871+
<entry>Number of points in path or polygon</entry>
38723872
<entry><literal># '((1,0),(0,1),(-1,0))'</literal></entry>
38733873
</row>
38743874
<row>
@@ -4025,6 +4025,18 @@ SELECT TIMESTAMP 'now';
40254025
<entry>length of item</entry>
40264026
<entry><literal>length(path '((-1,0),(1,0))')</literal></entry>
40274027
</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>
40284040
<row>
40294041
<entry><function>pclose</function>(path)</entry>
40304042
<entry><type>path</type></entry>
@@ -4040,12 +4052,6 @@ SELECT TIMESTAMP 'now';
40404052
<entry><literal>point(lseg '((-1,0),(1,0))',lseg '((-2,-2),(2,2))')</literal></entry>
40414053
</row>
40424054
]]>
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>
40494055
<row>
40504056
<entry><function>popen</function>(path)</entry>
40514057
<entry><type>path</type></entry>
@@ -4150,7 +4156,7 @@ SELECT TIMESTAMP 'now';
41504156
<row>
41514157
<entry><function>polygon</function>(<type>box</type>)</entry>
41524158
<entry><type>polygon</type></entry>
4153-
<entry>12 point polygon</entry>
4159+
<entry>4-point polygon</entry>
41544160
<entry><literal>polygon(box '((0,0),(1,1))')</literal></entry>
41554161
</row>
41564162
<row>
@@ -4175,6 +4181,16 @@ SELECT TIMESTAMP 'now';
41754181
</tgroup>
41764182
</table>
41774183

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+
41784194
</sect1>
41794195

41804196

0 commit comments

Comments
 (0)