]> granicus.if.org Git - postgresql/commitdiff
Some improvements in geometric-operators documentation.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 8 Aug 2002 14:29:07 +0000 (14:29 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 8 Aug 2002 14:29:07 +0000 (14:29 +0000)
doc/src/sgml/func.sgml

index aed47db79b92de57db3e615c234429b100ceed9c..8d722a91853ece180cd4e7092040bb0142d46a27 100644 (file)
@@ -1,5 +1,5 @@
 <!--
-$Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.108 2002/08/06 05:40:44 ishii Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.109 2002/08/08 14:29:07 tgl Exp $
 PostgreSQL documentation
 -->
 
@@ -3868,7 +3868,7 @@ SELECT TIMESTAMP 'now';
        </row>
        <row>
        <entry> # </entry>
-       <entry>Number of points in polygon</entry>
+       <entry>Number of points in path or polygon</entry>
        <entry><literal># '((1,0),(0,1),(-1,0))'</literal></entry>
        </row>
        <row>
@@ -4025,6 +4025,18 @@ SELECT TIMESTAMP 'now';
        <entry>length of item</entry>
        <entry><literal>length(path '((-1,0),(1,0))')</literal></entry>
        </row>
+       <row>
+       <entry><function>npoints</function>(path)</entry>
+       <entry><type>integer</type></entry>
+       <entry>number of points</entry>
+       <entry><literal>npoints(path '[(0,0),(1,1),(2,0)]')</literal></entry>
+       </row>
+       <row>
+       <entry><function>npoints</function>(polygon)</entry>
+       <entry><type>integer</type></entry>
+       <entry>number of points</entry>
+       <entry><literal>npoints(polygon '((1,1),(0,0))')</literal></entry>
+       </row>
        <row>
        <entry><function>pclose</function>(path)</entry>
        <entry><type>path</type></entry>
@@ -4040,12 +4052,6 @@ SELECT TIMESTAMP 'now';
        <entry><literal>point(lseg '((-1,0),(1,0))',lseg '((-2,-2),(2,2))')</literal></entry>
        </row>
 ]]>
-       <row>
-       <entry><function>npoint</function>(path)</entry>
-       <entry><type>integer</type></entry>
-       <entry>number of points</entry>
-       <entry><literal>npoints(path '[(0,0),(1,1),(2,0)]')</literal></entry>
-       </row>
        <row>
        <entry><function>popen</function>(path)</entry>
        <entry><type>path</type></entry>
@@ -4150,7 +4156,7 @@ SELECT TIMESTAMP 'now';
        <row>
        <entry><function>polygon</function>(<type>box</type>)</entry>
        <entry><type>polygon</type></entry>
-       <entry>12 point polygon</entry>
+       <entry>4-point polygon</entry>
        <entry><literal>polygon(box '((0,0),(1,1))')</literal></entry>
        </row>
        <row>
@@ -4175,6 +4181,16 @@ SELECT TIMESTAMP 'now';
      </tgroup>
    </table>
 
+    <para>
+     It is possible to access the two component numbers of a <type>point</>
+     as though it were an array with subscripts 0,1.  For example, if
+     <literal>t.p</> is a <type>point</> column then
+     <literal>SELECT p[0] FROM t</> retrieves the X coordinate;
+     <literal>UPDATE t SET p[1] = ...</> changes the Y coordinate.
+     In the same way, a <type>box</> or an <type>lseg</> may be treated
+     as an array of two <type>point</>s.
+    </para>
+
   </sect1>