📄 func.sgml
字号:
</row> <row> <entry> reltime(timespan) </entry> <entry> reltime </entry> <entry> convert to reltime </entry> <entry> reltime('4 hrs'::timespan) </entry> </row> <row> <entry> timespan(reltime) </entry> <entry> timespan </entry> <entry> convert to timespan </entry> <entry> timespan('4 hours'::reltime) </entry> </row> </tbody> </tgroup> </table> </para> <para> For the <function>date_part</function> and <function>date_trunc</function> functions, arguments can be `year', `month', `day', `hour', `minute', and `second', as well as the more specialized quantities `decade', `century', `millenium', `millisecond', and `microsecond'. <function>date_part</function> allows `dow' to return day of week and `epoch' to return seconds since 1970 (for <type>datetime</type>) or 'epoch' to return total elapsed seconds (for <type>timespan</type>). </para> </sect1> <sect1> <title>Geometric Functions</title> <para> The geometric types point, box, lseg, line, path, polygon, and circle have a large set of native support functions. </para> <para> <table tocentry="1"> <title>Geometric Functions</title> <tgroup cols="4"> <thead> <row> <entry>Function</entry> <entry>Returns</entry> <entry>Description</entry> <entry>Example</entry> </row> </thead> <tbody> <row> <entry> area(box) </entry> <entry> float8 </entry> <entry> area of box </entry> <entry> area('((0,0),(1,1))'::box) </entry> </row> <row> <entry> area(circle) </entry> <entry> float8 </entry> <entry> area of circle </entry> <entry> area('((0,0),2.0)'::circle) </entry> </row> <row> <entry> box(box,box) </entry> <entry> box </entry> <entry> boxes to intersection box </entry> <entry> box('((0,0),(1,1))','((0.5,0.5),(2,2))') </entry> </row> <row> <entry> center(box) </entry> <entry> point </entry> <entry> center of object </entry> <entry> center('((0,0),(1,2))'::box) </entry> </row> <row> <entry> center(circle) </entry> <entry> point </entry> <entry> center of object </entry> <entry> center('((0,0),2.0)'::circle) </entry> </row> <row> <entry> diameter(circle) </entry> <entry> float8 </entry> <entry> diameter of circle </entry> <entry> diameter('((0,0),2.0)'::circle) </entry> </row> <row> <entry> height(box) </entry> <entry> float8 </entry> <entry> vertical size of box </entry> <entry> height('((0,0),(1,1))'::box) </entry> </row> <row> <entry> isclosed(path) </entry> <entry> bool </entry> <entry> a closed path? </entry> <entry> isclosed('((0,0),(1,1),(2,0))'::path) </entry> </row> <row> <entry> isopen(path) </entry> <entry> bool </entry> <entry> an open path? </entry> <entry> isopen('[(0,0),(1,1),(2,0)]'::path) </entry> </row> <row> <entry> length(lseg) </entry> <entry> float8 </entry> <entry> length of line segment </entry> <entry> length('((-1,0),(1,0))'::lseg) </entry> </row> <row> <entry> length(path) </entry> <entry> float8 </entry> <entry> length of path </entry> <entry> length('((0,0),(1,1),(2,0))'::path) </entry> </row> <row> <entry> pclose(path) </entry> <entry> path </entry> <entry> convert path to closed </entry> <entry> popen('[(0,0),(1,1),(2,0)]'::path) </entry> </row> <row> <entry> point(lseg,lseg) </entry> <entry> point </entry> <entry> intersection </entry> <entry> point('((-1,0),(1,0))'::lseg,'((-2,-2),(2,2))'::lseg) </entry> </row> <row> <entry> points(path) </entry> <entry> int4 </entry> <entry> number of points </entry> <entry> points('[(0,0),(1,1),(2,0)]'::path) </entry> </row> <row> <entry> popen(path) </entry> <entry> path </entry> <entry> convert path to open </entry> <entry> popen('((0,0),(1,1),(2,0))'::path) </entry> </row> <row> <entry> radius(circle) </entry> <entry> float8 </entry> <entry> radius of circle </entry> <entry> radius('((0,0),2.0)'::circle) </entry> </row> <row> <entry> width(box) </entry> <entry> float8 </entry> <entry> horizontal size </entry> <entry> width('((0,0),(1,1))'::box) </entry> </row> </tbody> </tgroup> </table> </para> <para> <table tocentry="1"> <title>Geometric Type Conversion Functions</title> <tgroup cols="4"> <thead> <row> <entry>Function</entry> <entry>Returns</entry> <entry>Description</entry> <entry>Example</entry> </row> </thead> <tbody> <row> <entry> box(circle) </entry> <entry> box </entry> <entry> convert circle to box </entry> <entry> box('((0,0),2.0)'::circle) </entry> </row> <row> <entry> box(point,point) </entry> <entry> box </entry> <entry> convert points to box </entry> <entry> box('(0,0)'::point,'(1,1)'::point) </entry> </row> <row> <entry> box(polygon) </entry> <entry> box </entry> <entry> convert polygon to box </entry> <entry> box('((0,0),(1,1),(2,0))'::polygon) </entry> </row> <row> <entry> circle(box) </entry> <entry> circle </entry> <entry> convert to circle </entry> <entry> circle('((0,0),(1,1))'::box) </entry> </row> <row> <entry> circle(point,float8) </entry> <entry> circle </entry> <entry> convert to circle </entry> <entry> circle('(0,0)'::point,2.0) </entry> </row> <row> <entry> lseg(box) </entry> <entry> lseg </entry> <entry> convert diagonal to lseg </entry> <entry> lseg('((-1,0),(1,0))'::box) </entry> </row> <row> <entry> lseg(point,point) </entry> <entry> lseg </entry> <entry> convert to lseg </entry> <entry> lseg('(-1,0)'::point,'(1,0)'::point) </entry> </row> <row> <entry> path(polygon) </entry> <entry> point </entry> <entry> convert to path </entry> <entry> path('((0,0),(1,1),(2,0))'::polygon) </entry> </row> <row> <entry> point(circle) </entry> <entry> point </entry> <entry> convert to point (center) </entry> <entry> point('((0,0),2.0)'::circle) </entry> </row> <row> <entry> point(lseg,lseg) </entry> <entry> point </entry> <entry> convert to point (intersection) </entry> <entry> point('((-1,0),(1,0))'::lseg, '((-2,-2),(2,2))'::lseg) </entry> </row> <row> <entry> point(polygon) </entry> <entry> point </entry> <entry> center of polygon </entry> <entry> point('((0,0),(1,1),(2,0))'::polygon) </entry> </row> <row> <entry> polygon(box) </entry> <entry> polygon </entry> <entry> convert to polygon with 12 points </entry> <entry> polygon('((0,0),(1,1))'::box) </entry> </row> <row> <entry> polygon(circle) </entry> <entry> polygon </entry> <entry> convert to 12-point polygon </entry> <entry> polygon('((0,0),2.0)'::circle) </entry> </row> <row> <entry> polygon(<replaceable class="parameter">npts</replaceable>,circle) </entry> <entry> polygon </entry> <entry> convert to <replaceable class="parameter">npts</replaceable> polygon </entry> <entry> polygon(12,'((0,0),2.0)'::circle) </entry> </row> <row> <entry> polygon(path) </entry> <entry> polygon </entry> <entry> convert to polygon </entry> <entry> polygon('((0,0),(1,1),(2,0))'::path) </entry> </row> </tbody> </tgroup> </table> </para> <para> <table tocentry="1"> <title>Geometric Upgrade Functions</title> <tgroup cols="4"> <thead> <row> <entry>Function</entry> <entry>Returns</entry> <entry>Description</entry> <entry>Example</entry> </row> </thead> <tbody> <row> <entry> isoldpath(path) </entry> <entry> path </entry> <entry> test path for pre-v6.1 form </entry> <entry> isoldpath('(1,3,0,0,1,1,2,0)'::path) </entry> </row> <row> <entry> revertpoly(polygon) </entry> <entry> polygon </entry> <entry> convert pre-v6.1 polygon </entry> <entry> revertpoly('((0,0),(1,1),(2,0))'::polygon) </entry> </row> <row> <entry> upgradepath(path) </entry> <entry> path </entry> <entry> convert pre-v6.1 path </entry> <entry> upgradepath('(1,3,0,0,1,1,2,0)'::path) </entry> </row> <row> <entry> upgradepoly(polygon) </entry> <entry> polygon </entry> <entry> convert pre-v6.1 polygon </entry> <entry> upgradepoly('(0,1,2,0,1,0)'::polygon) </entry> </row> </tbody> </tgroup> </table> </para> </sect1> <sect1> <title id="cidr-funcs">IP V4 Functions</title> <para> <table tocentry="1"> <title><productname>Postgres</productname>IP V4 Functions</title> <tgroup cols="4"> <thead> <row> <entry>Function</entry> <entry>Returns</entry> <entry>Description</entry> <entry>Example</entry> </row> </thead> <tbody> <row> <entry> broadcast(cidr) </entry> <entry> text </entry> <entry> construct broadcast address as text </entry> <entry> broadcast('192.168.1.5/24') </entry> </row> <row> <entry> broadcast(inet) </entry> <entry> text </entry> <entry> construct broadcast address as text </entry> <entry> broadcast('192.168.1.5/24') </entry> </row> <row> <entry> host(inet) </entry> <entry> text </entry> <entry> extract host address as text </entry> <entry> host('192.168.1.5/24') </entry> </row> <row> <entry> masklen(cidr) </entry> <entry> int4 </entry> <entry> calculate netmask length </entry> <entry> masklen('192.168.1.5/24') </entry> </row> <row> <entry> masklen(inet) </entry> <entry> int4 </entry> <entry> calculate netmask length </entry> <entry> masklen('192.168.1.5/24') </entry> </row> <row> <entry> netmask(inet) </entry> <entry> text </entry> <entry> construct netmask as text </entry> <entry> netmask('192.168.1.5/24') </entry> </row> </tbody> </tgroup> </table> </para> </sect1> </chapter><!-- Keep this comment at the end of the fileLocal variables:mode: sgmlsgml-omittag:nilsgml-shorttag:tsgml-minimize-attributes:nilsgml-always-quote-attributes:tsgml-indent-step:1sgml-indent-data:tsgml-parent-document:nilsgml-default-dtd-file:"./reference.ced"sgml-exposed-tags:nilsgml-local-catalogs:"/usr/lib/sgml/catalog"sgml-local-ecat-files:nilEnd:-->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -