1- <!-- $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.47 2001/01/13 18:34:51 petere Exp $ -->
1+ <!-- $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.48 2001/01/20 20:59:28 petere Exp $ -->
22
33<chapter id="functions">
44 <title>Functions and Operators</title>
12741274<entry>to_char(125, '999')</entry>
12751275 </row>
12761276 <row>
1277- <entry>to_char(float , text)</entry>
1277+ <entry>to_char(double precision , text)</entry>
12781278<entry>text</entry>
1279- <entry>convertfloat4/float8 to string</entry>
1279+ <entry>convertreal/double precision to string</entry>
12801280<entry>to_char(125.8, '999D9')</entry>
12811281 </row>
12821282 <row>
19271927 </row>
19281928 <row>
19291929<entry>date_part(text,timestamp)</entry>
1930- <entry>float8 </entry>
1930+ <entry>double precision </entry>
19311931<entry>portion of date</entry>
19321932<entry>date_part('dow',timestamp 'now')</entry>
19331933 </row>
19341934 <row>
19351935<entry>date_part(text,interval)</entry>
1936- <entry>float8 </entry>
1936+ <entry>double precision </entry>
19371937<entry>portion of time</entry>
19381938<entry>date_part('hour',interval '4 hrs 3 mins')</entry>
19391939 </row>
20332033 <ROW>
20342034<ENTRY> + </ENTRY>
20352035<ENTRY>Translation</ENTRY>
2036- <ENTRY>'((0,0),(1,1))'::box + '(2.0,0)'::point </ENTRY>
2036+ <ENTRY>box '((0,0),(1,1))' +point '(2.0,0)'</ENTRY>
20372037 </ROW>
20382038 <ROW>
20392039<ENTRY> - </ENTRY>
20402040<ENTRY>Translation</ENTRY>
2041- <ENTRY>'((0,0),(1,1))'::box - '(2.0,0)'::point </ENTRY>
2041+ <ENTRY>box '((0,0),(1,1))' -point '(2.0,0)'</ENTRY>
20422042 </ROW>
20432043 <ROW>
20442044<ENTRY> * </ENTRY>
20452045<ENTRY>Scaling/rotation</ENTRY>
2046- <ENTRY>'((0,0),(1,1))'::box * '(2.0,0)'::point </ENTRY>
2046+ <ENTRY>box '((0,0),(1,1))' *point '(2.0,0)'</ENTRY>
20472047 </ROW>
20482048 <ROW>
20492049<ENTRY> / </ENTRY>
20502050<ENTRY>Scaling/rotation</ENTRY>
2051- <ENTRY>'((0,0),(2,2))'::box / '(2.0,0)'::point </ENTRY>
2051+ <ENTRY>box '((0,0),(2,2))' /point '(2.0,0)'</ENTRY>
20522052 </ROW>
20532053 <ROW>
20542054<ENTRY> # </ENTRY>
20632063 <ROW>
20642064<ENTRY> ## </ENTRY>
20652065<ENTRY>Point of closest proximity</ENTRY>
2066- <ENTRY>'(0,0)'::point ## '((2,0),(0,2))'::lseg </ENTRY>
2066+ <ENTRY>point '(0,0)' ##lseg '((2,0),(0,2))'</ENTRY>
20672067 </ROW>
20682068 <ROW>
20692069<ENTRY> && </ENTRY>
20702070<ENTRY>Overlaps?</ENTRY>
2071- <ENTRY>'((0,0),(1,1))'::box && '((0,0),(2,2))'::box </ENTRY>
2071+ <ENTRY>box '((0,0),(1,1))' &&box '((0,0),(2,2))'</ENTRY>
20722072 </ROW>
20732073 <ROW>
20742074<ENTRY> &< </ENTRY>
20752075<ENTRY>Overlaps to left?</ENTRY>
2076- <ENTRY>'((0,0),(1,1))'::box &< '((0,0),(2,2))'::box </ENTRY>
2076+ <ENTRY>box '((0,0),(1,1))' &<box '((0,0),(2,2))'</ENTRY>
20772077 </ROW>
20782078 <ROW>
20792079<ENTRY> &> </ENTRY>
20802080<ENTRY>Overlaps to right?</ENTRY>
2081- <ENTRY>'((0,0),(3,3))'::box &> '((0,0),(2,2))'::box </ENTRY>
2081+ <ENTRY>box '((0,0),(3,3))' &>box '((0,0),(2,2))'</ENTRY>
20822082 </ROW>
20832083 <ROW>
20842084<ENTRY> <-> </ENTRY>
20852085<ENTRY>Distance between</ENTRY>
2086- <ENTRY>'((0,0),1)'::circle <-> '((5,0),1)'::circle </ENTRY>
2086+ <ENTRY>circle '((0,0),1)' <->circle '((5,0),1)'</ENTRY>
20872087 </ROW>
20882088 <ROW>
20892089<ENTRY> << </ENTRY>
20902090<ENTRY>Left of?</ENTRY>
2091- <ENTRY>'((0,0),1)'::circle << '((5,0),1)'::circle </ENTRY>
2091+ <ENTRY>circle '((0,0),1)' <<circle '((5,0),1)'</ENTRY>
20922092 </ROW>
20932093 <ROW>
20942094<ENTRY> <^ </ENTRY>
20952095<ENTRY>Is below?</ENTRY>
2096- <ENTRY>'((0,0),1)'::circle <^ '((0,5),1)'::circle </ENTRY>
2096+ <ENTRY>circle '((0,0),1)' <^circle '((0,5),1)'</ENTRY>
20972097 </ROW>
20982098 <ROW>
20992099<ENTRY> >> </ENTRY>
21002100<ENTRY>Is right of?</ENTRY>
2101- <ENTRY>'((5,0),1)'::circle >> '((0,0),1)'::circle </ENTRY>
2101+ <ENTRY>circle '((5,0),1)' >>circle '((0,0),1)'</ENTRY>
21022102 </ROW>
21032103 <ROW>
21042104<ENTRY> >^ </ENTRY>
21052105<ENTRY>Is above?</ENTRY>
2106- <ENTRY>'((0,5),1)'::circle >^ '((0,0),1)'::circle </ENTRY>
2106+ <ENTRY>circle '((0,5),1)' >^circle '((0,0),1)'</ENTRY>
21072107 </ROW>
21082108 <ROW>
21092109<ENTRY> ?# </ENTRY>
21102110<ENTRY>Intersects or overlaps</ENTRY>
2111- <ENTRY>'((-1,0),(1,0))'::lseg ?# '((-2,-2),(2,2))'::box ;</ENTRY>
2111+ <ENTRY>lseg '((-1,0),(1,0))' ?#box '((-2,-2),(2,2))';</ENTRY>
21122112 </ROW>
21132113 <ROW>
21142114<ENTRY> ?- </ENTRY>
21152115<ENTRY>Is horizontal?</ENTRY>
2116- <ENTRY>'(1,0)'::point ?- '(0,0)'::point </ENTRY>
2116+ <ENTRY>point '(1,0)' ?-point '(0,0)'</ENTRY>
21172117 </ROW>
21182118 <ROW>
21192119<ENTRY> ?-| </ENTRY>
21202120<ENTRY>Is perpendicular?</ENTRY>
2121- <ENTRY>'((0,0),(0,1))'::lseg ?-| '((0,0),(1,0))'::lseg </ENTRY>
2121+ <ENTRY>lseg '((0,0),(0,1))' ?-|lseg '((0,0),(1,0))'</ENTRY>
21222122 </ROW>
21232123 <ROW>
21242124<ENTRY> @-@ </ENTRY>
21252125<ENTRY>Length or circumference</ENTRY>
2126- <ENTRY>@-@ '((0,0),(1,0))'::path </ENTRY>
2126+ <ENTRY>@-@path '((0,0),(1,0))'</ENTRY>
21272127 </ROW>
21282128 <ROW>
21292129<ENTRY> ?| </ENTRY>
21302130<ENTRY>Is vertical?</ENTRY>
2131- <ENTRY>'(0,1)'::point ?| '(0,0)'::point </ENTRY>
2131+ <ENTRY>point '(0,1)' ?|point '(0,0)'</ENTRY>
21322132 </ROW>
21332133 <ROW>
21342134<ENTRY> ?|| </ENTRY>
21352135<ENTRY>Is parallel?</ENTRY>
2136- <ENTRY>'((-1,0),(1,0))'::lseg ?|| '((-1,2),(1,2))'::lseg </ENTRY>
2136+ <ENTRY>lseg '((-1,0),(1,0))' ?||lseg '((-1,2),(1,2))'</ENTRY>
21372137 </ROW>
21382138 <ROW>
21392139<ENTRY> @ </ENTRY>
21402140<ENTRY>Contained or on</ENTRY>
2141- <ENTRY>'(1,1)'::point @ '((0,0),2)'::circle </ENTRY>
2141+ <ENTRY>point '(1,1)' @circle '((0,0),2)'</ENTRY>
21422142 </ROW>
21432143 <ROW>
21442144<ENTRY> @@ </ENTRY>
21452145<ENTRY>Center of</ENTRY>
2146- <ENTRY>@@ '((0,0),10)'::circle </ENTRY>
2146+ <ENTRY>@@circle '((0,0),10)'</ENTRY>
21472147 </ROW>
21482148 <ROW>
21492149<ENTRY> ~= </ENTRY>
21502150<ENTRY>Same as</ENTRY>
2151- <ENTRY>'((0,0),(1,1))'::polygon ~= '((1,1),(0,0))'::polygon </ENTRY>
2151+ <ENTRY>polygon '((0,0),(1,1))' ~=polygon '((1,1),(0,0))'</ENTRY>
21522152 </ROW>
21532153 </TBODY>
21542154 </TGROUP>
21682168 <tbody>
21692169 <row>
21702170<entry>area(object)</entry>
2171- <entry>float8 </entry>
2171+ <entry>double precision </entry>
21722172<entry>area of item</entry>
21732173<entry>area(box '((0,0),(1,1))')</entry>
21742174 </row>
21752175 <row>
2176- <entry>box(box,box)</entry>
2176+ <entry>box(box, box)</entry>
21772177<entry>box</entry>
21782178<entry>intersection box</entry>
21792179<entry>box(box '((0,0),(1,1))',box '((0.5,0.5),(2,2))')</entry>
21862186 </row>
21872187 <row>
21882188<entry>diameter(circle)</entry>
2189- <entry>float8 </entry>
2189+ <entry>double precision </entry>
21902190<entry>diameter of circle</entry>
21912191<entry>diameter(circle '((0,0),2.0)')</entry>
21922192 </row>
21932193 <row>
21942194<entry>height(box)</entry>
2195- <entry>float8 </entry>
2195+ <entry>double precision </entry>
21962196<entry>vertical size of box</entry>
21972197<entry>height(box '((0,0),(1,1))')</entry>
21982198 </row>
22102210 </row>
22112211 <row>
22122212<entry>length(object)</entry>
2213- <entry>float8 </entry>
2213+ <entry>double precision </entry>
22142214<entry>length of item</entry>
22152215<entry>length(path '((-1,0),(1,0))')</entry>
22162216 </row>
@@ -2243,13 +2243,13 @@ Not defined by this name. Implements the intersection operator '#'
22432243 </row>
22442244 <row>
22452245<entry>radius(circle)</entry>
2246- <entry>float8 </entry>
2246+ <entry>double precision </entry>
22472247<entry>radius of circle</entry>
22482248<entry>radius(circle '((0,0),2.0)')</entry>
22492249 </row>
22502250 <row>
22512251<entry>width(box)</entry>
2252- <entry>float8 </entry>
2252+ <entry>double precision </entry>
22532253<entry>horizontal size</entry>
22542254<entry>width(box '((0,0),(1,1))')</entry>
22552255 </row>
@@ -2274,91 +2274,91 @@ Not defined by this name. Implements the intersection operator '#'
22742274<entry>box(circle)</entry>
22752275<entry>box</entry>
22762276<entry>circle to box</entry>
2277- <entry>box('((0,0),2.0)'::circle )</entry>
2277+ <entry>box(circle '((0,0),2.0)')</entry>
22782278 </row>
22792279 <row>
2280- <entry>box(point,point)</entry>
2280+ <entry>box(point, point)</entry>
22812281<entry>box</entry>
22822282<entry>points to box</entry>
2283- <entry>box('(0,0)'::point, '(1,1)'::point )</entry>
2283+ <entry>box(point '(0,0)', point '(1,1)')</entry>
22842284 </row>
22852285 <row>
22862286<entry>box(polygon)</entry>
22872287<entry>box</entry>
22882288<entry>polygon to box</entry>
2289- <entry>box('((0,0),(1,1),(2,0))'::polygon )</entry>
2289+ <entry>box(polygon '((0,0),(1,1),(2,0))')</entry>
22902290 </row>
22912291 <row>
22922292<entry>circle(box)</entry>
22932293<entry>circle</entry>
22942294<entry>to circle</entry>
2295- <entry>circle('((0,0),(1,1))'::box )</entry>
2295+ <entry>circle(box '((0,0),(1,1))')</entry>
22962296 </row>
22972297 <row>
2298- <entry>circle(point,float8 )</entry>
2298+ <entry>circle(point, double precision )</entry>
22992299<entry>circle</entry>
23002300<entry>point to circle</entry>
2301- <entry>circle('(0,0)'::point, 2.0)</entry>
2301+ <entry>circle(point '(0,0)', 2.0)</entry>
23022302 </row>
23032303 <row>
23042304<entry>lseg(box)</entry>
23052305<entry>lseg</entry>
23062306<entry>box diagonal to lseg</entry>
2307- <entry>lseg('((-1,0),(1,0))'::box )</entry>
2307+ <entry>lseg(box '((-1,0),(1,0))')</entry>
23082308 </row>
23092309 <row>
2310- <entry>lseg(point,point)</entry>
2310+ <entry>lseg(point, point)</entry>
23112311<entry>lseg</entry>
23122312<entry>points to lseg</entry>
2313- <entry>lseg('(-1,0)'::point, '(1,0)'::point )</entry>
2313+ <entry>lseg(point '(-1,0)', point '(1,0)')</entry>
23142314 </row>
23152315 <row>
23162316<entry>path(polygon)</entry>
23172317<entry>point</entry>
23182318<entry>polygon to path</entry>
2319- <entry>path('((0,0),(1,1),(2,0))'::polygon )</entry>
2319+ <entry>path(polygon '((0,0),(1,1),(2,0))')</entry>
23202320 </row>
23212321 <row>
23222322<entry>point(circle)</entry>
23232323<entry>point</entry>
23242324<entry>center</entry>
2325- <entry>point('((0,0),2.0)'::circle )</entry>
2325+ <entry>point(circle '((0,0),2.0)')</entry>
23262326 </row>
23272327 <row>
2328- <entry>point(lseg,lseg)</entry>
2328+ <entry>point(lseg, lseg)</entry>
23292329<entry>point</entry>
23302330<entry>intersection</entry>
2331- <entry>point('((-1,0),(1,0))'::lseg, '((-2,-2),(2,2))'::lseg )</entry>
2331+ <entry>point(lseg '((-1,0),(1,0))', lseg '((-2,-2),(2,2))')</entry>
23322332 </row>
23332333 <row>
23342334<entry>point(polygon)</entry>
23352335<entry>point</entry>
23362336<entry>center</entry>
2337- <entry>point('((0,0),(1,1),(2,0))'::polygon )</entry>
2337+ <entry>point(polygon '((0,0),(1,1),(2,0))')</entry>
23382338 </row>
23392339 <row>
23402340<entry>polygon(box)</entry>
23412341<entry>polygon</entry>
23422342<entry>12 point polygon</entry>
2343- <entry>polygon('((0,0),(1,1))'::box )</entry>
2343+ <entry>polygon(box '((0,0),(1,1))')</entry>
23442344 </row>
23452345 <row>
23462346<entry>polygon(circle)</entry>
23472347<entry>polygon</entry>
23482348<entry>12-point polygon</entry>
2349- <entry>polygon('((0,0),2.0)'::circle )</entry>
2349+ <entry>polygon(circle '((0,0),2.0)')</entry>
23502350 </row>
23512351 <row>
2352- <entry>polygon(<replaceable class="parameter">npts</replaceable>,circle)</entry>
2352+ <entry>polygon(<replaceable class="parameter">npts</replaceable>, circle)</entry>
23532353<entry>polygon</entry>
23542354<entry><replaceable class="parameter">npts</replaceable> polygon</entry>
2355- <entry>polygon(12,'((0,0),2.0)'::circle )</entry>
2355+ <entry>polygon(12, circle '((0,0),2.0)')</entry>
23562356 </row>
23572357 <row>
23582358<entry>polygon(path)</entry>
23592359<entry>polygon</entry>
23602360<entry>path to polygon</entry>
2361- <entry>polygon('((0,0),(1,1),(2,0))'::path )</entry>
2361+ <entry>polygon(path '((0,0),(1,1),(2,0))')</entry>
23622362 </row>
23632363 </tbody>
23642364 </tgroup>