mirror of
https://github.com/postgres/postgres.git
synced 2025-05-02 11:44:50 +03:00
Replace some oldish, non-SQL'ish elements with more standard forms. (cast
syntax, type names, function names, etc.)
This commit is contained in:
parent
8453208634
commit
74bbe8097d
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$Header: /cvsroot/pgsql/doc/src/sgml/dfunc.sgml,v 1.12 2001/01/12 22:15:32 petere Exp $
|
$Header: /cvsroot/pgsql/doc/src/sgml/dfunc.sgml,v 1.13 2001/01/20 20:59:28 petere Exp $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<sect2 id="dfunc">
|
<sect2 id="dfunc">
|
||||||
@ -20,7 +20,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/dfunc.sgml,v 1.12 2001/01/12 22:15:32 peter
|
|||||||
In addition, the <productname>PostgreSQL</productname> source code
|
In addition, the <productname>PostgreSQL</productname> source code
|
||||||
contains several working examples in the
|
contains several working examples in the
|
||||||
<filename>contrib</filename> directory. If you rely on these
|
<filename>contrib</filename> directory. If you rely on these
|
||||||
examples you will make your modules dependent on the documentation
|
examples you will make your modules dependent on the availability
|
||||||
of the <productname>PostgreSQL</productname> source code, however.
|
of the <productname>PostgreSQL</productname> source code, however.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@ -29,8 +29,8 @@ $Header: /cvsroot/pgsql/doc/src/sgml/dfunc.sgml,v 1.12 2001/01/12 22:15:32 peter
|
|||||||
executables: first the source files are compiled into object files,
|
executables: first the source files are compiled into object files,
|
||||||
then the object files are linked together. The object files need to
|
then the object files are linked together. The object files need to
|
||||||
be created as <firstterm>position-independent code</firstterm>
|
be created as <firstterm>position-independent code</firstterm>
|
||||||
(<acronym>PIC</acronym>), which conceptually means that it can be
|
(<acronym>PIC</acronym>), which conceptually means that they can be
|
||||||
placed at an arbitrary location in memory when it is loaded by the
|
placed at an arbitrary location in memory when they are loaded by the
|
||||||
executable. (Object files intended for executables are not compiled
|
executable. (Object files intended for executables are not compiled
|
||||||
that way.) The command to link a shared library contains special
|
that way.) The command to link a shared library contains special
|
||||||
flags to distinguish it from linking an executable. --- At least
|
flags to distinguish it from linking an executable. --- At least
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.47 2001/01/13 18:34:51 petere Exp $ -->
|
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.48 2001/01/20 20:59:28 petere Exp $ -->
|
||||||
|
|
||||||
<chapter id="functions">
|
<chapter id="functions">
|
||||||
<title>Functions and Operators</title>
|
<title>Functions and Operators</title>
|
||||||
@ -1274,9 +1274,9 @@
|
|||||||
<entry>to_char(125, '999')</entry>
|
<entry>to_char(125, '999')</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>to_char(float, text)</entry>
|
<entry>to_char(double precision, text)</entry>
|
||||||
<entry>text</entry>
|
<entry>text</entry>
|
||||||
<entry>convert float4/float8 to string</entry>
|
<entry>convert real/double precision to string</entry>
|
||||||
<entry>to_char(125.8, '999D9')</entry>
|
<entry>to_char(125.8, '999D9')</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@ -1927,13 +1927,13 @@
|
|||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>date_part(text,timestamp)</entry>
|
<entry>date_part(text,timestamp)</entry>
|
||||||
<entry>float8</entry>
|
<entry>double precision</entry>
|
||||||
<entry>portion of date</entry>
|
<entry>portion of date</entry>
|
||||||
<entry>date_part('dow',timestamp 'now')</entry>
|
<entry>date_part('dow',timestamp 'now')</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>date_part(text,interval)</entry>
|
<entry>date_part(text,interval)</entry>
|
||||||
<entry>float8</entry>
|
<entry>double precision</entry>
|
||||||
<entry>portion of time</entry>
|
<entry>portion of time</entry>
|
||||||
<entry>date_part('hour',interval '4 hrs 3 mins')</entry>
|
<entry>date_part('hour',interval '4 hrs 3 mins')</entry>
|
||||||
</row>
|
</row>
|
||||||
@ -2033,22 +2033,22 @@
|
|||||||
<ROW>
|
<ROW>
|
||||||
<ENTRY> + </ENTRY>
|
<ENTRY> + </ENTRY>
|
||||||
<ENTRY>Translation</ENTRY>
|
<ENTRY>Translation</ENTRY>
|
||||||
<ENTRY>'((0,0),(1,1))'::box + '(2.0,0)'::point</ENTRY>
|
<ENTRY>box '((0,0),(1,1))' + point '(2.0,0)'</ENTRY>
|
||||||
</ROW>
|
</ROW>
|
||||||
<ROW>
|
<ROW>
|
||||||
<ENTRY> - </ENTRY>
|
<ENTRY> - </ENTRY>
|
||||||
<ENTRY>Translation</ENTRY>
|
<ENTRY>Translation</ENTRY>
|
||||||
<ENTRY>'((0,0),(1,1))'::box - '(2.0,0)'::point</ENTRY>
|
<ENTRY>box '((0,0),(1,1))' - point '(2.0,0)'</ENTRY>
|
||||||
</ROW>
|
</ROW>
|
||||||
<ROW>
|
<ROW>
|
||||||
<ENTRY> * </ENTRY>
|
<ENTRY> * </ENTRY>
|
||||||
<ENTRY>Scaling/rotation</ENTRY>
|
<ENTRY>Scaling/rotation</ENTRY>
|
||||||
<ENTRY>'((0,0),(1,1))'::box * '(2.0,0)'::point</ENTRY>
|
<ENTRY>box '((0,0),(1,1))' * point '(2.0,0)'</ENTRY>
|
||||||
</ROW>
|
</ROW>
|
||||||
<ROW>
|
<ROW>
|
||||||
<ENTRY> / </ENTRY>
|
<ENTRY> / </ENTRY>
|
||||||
<ENTRY>Scaling/rotation</ENTRY>
|
<ENTRY>Scaling/rotation</ENTRY>
|
||||||
<ENTRY>'((0,0),(2,2))'::box / '(2.0,0)'::point</ENTRY>
|
<ENTRY>box '((0,0),(2,2))' / point '(2.0,0)'</ENTRY>
|
||||||
</ROW>
|
</ROW>
|
||||||
<ROW>
|
<ROW>
|
||||||
<ENTRY> # </ENTRY>
|
<ENTRY> # </ENTRY>
|
||||||
@ -2063,92 +2063,92 @@
|
|||||||
<ROW>
|
<ROW>
|
||||||
<ENTRY> ## </ENTRY>
|
<ENTRY> ## </ENTRY>
|
||||||
<ENTRY>Point of closest proximity</ENTRY>
|
<ENTRY>Point of closest proximity</ENTRY>
|
||||||
<ENTRY>'(0,0)'::point ## '((2,0),(0,2))'::lseg</ENTRY>
|
<ENTRY>point '(0,0)' ## lseg '((2,0),(0,2))'</ENTRY>
|
||||||
</ROW>
|
</ROW>
|
||||||
<ROW>
|
<ROW>
|
||||||
<ENTRY> && </ENTRY>
|
<ENTRY> && </ENTRY>
|
||||||
<ENTRY>Overlaps?</ENTRY>
|
<ENTRY>Overlaps?</ENTRY>
|
||||||
<ENTRY>'((0,0),(1,1))'::box && '((0,0),(2,2))'::box</ENTRY>
|
<ENTRY>box '((0,0),(1,1))' && box '((0,0),(2,2))'</ENTRY>
|
||||||
</ROW>
|
</ROW>
|
||||||
<ROW>
|
<ROW>
|
||||||
<ENTRY> &< </ENTRY>
|
<ENTRY> &< </ENTRY>
|
||||||
<ENTRY>Overlaps to left?</ENTRY>
|
<ENTRY>Overlaps to left?</ENTRY>
|
||||||
<ENTRY>'((0,0),(1,1))'::box &< '((0,0),(2,2))'::box</ENTRY>
|
<ENTRY>box '((0,0),(1,1))' &< box '((0,0),(2,2))'</ENTRY>
|
||||||
</ROW>
|
</ROW>
|
||||||
<ROW>
|
<ROW>
|
||||||
<ENTRY> &> </ENTRY>
|
<ENTRY> &> </ENTRY>
|
||||||
<ENTRY>Overlaps to right?</ENTRY>
|
<ENTRY>Overlaps to right?</ENTRY>
|
||||||
<ENTRY>'((0,0),(3,3))'::box &> '((0,0),(2,2))'::box</ENTRY>
|
<ENTRY>box '((0,0),(3,3))' &> box '((0,0),(2,2))'</ENTRY>
|
||||||
</ROW>
|
</ROW>
|
||||||
<ROW>
|
<ROW>
|
||||||
<ENTRY> <-> </ENTRY>
|
<ENTRY> <-> </ENTRY>
|
||||||
<ENTRY>Distance between</ENTRY>
|
<ENTRY>Distance between</ENTRY>
|
||||||
<ENTRY>'((0,0),1)'::circle <-> '((5,0),1)'::circle</ENTRY>
|
<ENTRY>circle '((0,0),1)' <-> circle '((5,0),1)'</ENTRY>
|
||||||
</ROW>
|
</ROW>
|
||||||
<ROW>
|
<ROW>
|
||||||
<ENTRY> << </ENTRY>
|
<ENTRY> << </ENTRY>
|
||||||
<ENTRY>Left of?</ENTRY>
|
<ENTRY>Left of?</ENTRY>
|
||||||
<ENTRY>'((0,0),1)'::circle << '((5,0),1)'::circle</ENTRY>
|
<ENTRY>circle '((0,0),1)' << circle '((5,0),1)'</ENTRY>
|
||||||
</ROW>
|
</ROW>
|
||||||
<ROW>
|
<ROW>
|
||||||
<ENTRY> <^ </ENTRY>
|
<ENTRY> <^ </ENTRY>
|
||||||
<ENTRY>Is below?</ENTRY>
|
<ENTRY>Is below?</ENTRY>
|
||||||
<ENTRY>'((0,0),1)'::circle <^ '((0,5),1)'::circle</ENTRY>
|
<ENTRY>circle '((0,0),1)' <^ circle '((0,5),1)'</ENTRY>
|
||||||
</ROW>
|
</ROW>
|
||||||
<ROW>
|
<ROW>
|
||||||
<ENTRY> >> </ENTRY>
|
<ENTRY> >> </ENTRY>
|
||||||
<ENTRY>Is right of?</ENTRY>
|
<ENTRY>Is right of?</ENTRY>
|
||||||
<ENTRY>'((5,0),1)'::circle >> '((0,0),1)'::circle</ENTRY>
|
<ENTRY>circle '((5,0),1)' >> circle '((0,0),1)'</ENTRY>
|
||||||
</ROW>
|
</ROW>
|
||||||
<ROW>
|
<ROW>
|
||||||
<ENTRY> >^ </ENTRY>
|
<ENTRY> >^ </ENTRY>
|
||||||
<ENTRY>Is above?</ENTRY>
|
<ENTRY>Is above?</ENTRY>
|
||||||
<ENTRY>'((0,5),1)'::circle >^ '((0,0),1)'::circle</ENTRY>
|
<ENTRY>circle '((0,5),1)' >^ circle '((0,0),1)'</ENTRY>
|
||||||
</ROW>
|
</ROW>
|
||||||
<ROW>
|
<ROW>
|
||||||
<ENTRY> ?# </ENTRY>
|
<ENTRY> ?# </ENTRY>
|
||||||
<ENTRY>Intersects or overlaps</ENTRY>
|
<ENTRY>Intersects or overlaps</ENTRY>
|
||||||
<ENTRY>'((-1,0),(1,0))'::lseg ?# '((-2,-2),(2,2))'::box;</ENTRY>
|
<ENTRY>lseg '((-1,0),(1,0))' ?# box '((-2,-2),(2,2))';</ENTRY>
|
||||||
</ROW>
|
</ROW>
|
||||||
<ROW>
|
<ROW>
|
||||||
<ENTRY> ?- </ENTRY>
|
<ENTRY> ?- </ENTRY>
|
||||||
<ENTRY>Is horizontal?</ENTRY>
|
<ENTRY>Is horizontal?</ENTRY>
|
||||||
<ENTRY>'(1,0)'::point ?- '(0,0)'::point</ENTRY>
|
<ENTRY>point '(1,0)' ?- point '(0,0)'</ENTRY>
|
||||||
</ROW>
|
</ROW>
|
||||||
<ROW>
|
<ROW>
|
||||||
<ENTRY> ?-| </ENTRY>
|
<ENTRY> ?-| </ENTRY>
|
||||||
<ENTRY>Is perpendicular?</ENTRY>
|
<ENTRY>Is perpendicular?</ENTRY>
|
||||||
<ENTRY>'((0,0),(0,1))'::lseg ?-| '((0,0),(1,0))'::lseg</ENTRY>
|
<ENTRY>lseg '((0,0),(0,1))' ?-| lseg '((0,0),(1,0))'</ENTRY>
|
||||||
</ROW>
|
</ROW>
|
||||||
<ROW>
|
<ROW>
|
||||||
<ENTRY> @-@ </ENTRY>
|
<ENTRY> @-@ </ENTRY>
|
||||||
<ENTRY>Length or circumference</ENTRY>
|
<ENTRY>Length or circumference</ENTRY>
|
||||||
<ENTRY>@-@ '((0,0),(1,0))'::path</ENTRY>
|
<ENTRY>@-@ path '((0,0),(1,0))'</ENTRY>
|
||||||
</ROW>
|
</ROW>
|
||||||
<ROW>
|
<ROW>
|
||||||
<ENTRY> ?| </ENTRY>
|
<ENTRY> ?| </ENTRY>
|
||||||
<ENTRY>Is vertical?</ENTRY>
|
<ENTRY>Is vertical?</ENTRY>
|
||||||
<ENTRY>'(0,1)'::point ?| '(0,0)'::point</ENTRY>
|
<ENTRY>point '(0,1)' ?| point '(0,0)'</ENTRY>
|
||||||
</ROW>
|
</ROW>
|
||||||
<ROW>
|
<ROW>
|
||||||
<ENTRY> ?|| </ENTRY>
|
<ENTRY> ?|| </ENTRY>
|
||||||
<ENTRY>Is parallel?</ENTRY>
|
<ENTRY>Is parallel?</ENTRY>
|
||||||
<ENTRY>'((-1,0),(1,0))'::lseg ?|| '((-1,2),(1,2))'::lseg</ENTRY>
|
<ENTRY>lseg '((-1,0),(1,0))' ?|| lseg '((-1,2),(1,2))'</ENTRY>
|
||||||
</ROW>
|
</ROW>
|
||||||
<ROW>
|
<ROW>
|
||||||
<ENTRY> @ </ENTRY>
|
<ENTRY> @ </ENTRY>
|
||||||
<ENTRY>Contained or on</ENTRY>
|
<ENTRY>Contained or on</ENTRY>
|
||||||
<ENTRY>'(1,1)'::point @ '((0,0),2)'::circle</ENTRY>
|
<ENTRY>point '(1,1)' @ circle '((0,0),2)'</ENTRY>
|
||||||
</ROW>
|
</ROW>
|
||||||
<ROW>
|
<ROW>
|
||||||
<ENTRY> @@ </ENTRY>
|
<ENTRY> @@ </ENTRY>
|
||||||
<ENTRY>Center of</ENTRY>
|
<ENTRY>Center of</ENTRY>
|
||||||
<ENTRY>@@ '((0,0),10)'::circle</ENTRY>
|
<ENTRY>@@ circle '((0,0),10)'</ENTRY>
|
||||||
</ROW>
|
</ROW>
|
||||||
<ROW>
|
<ROW>
|
||||||
<ENTRY> ~= </ENTRY>
|
<ENTRY> ~= </ENTRY>
|
||||||
<ENTRY>Same as</ENTRY>
|
<ENTRY>Same as</ENTRY>
|
||||||
<ENTRY>'((0,0),(1,1))'::polygon ~= '((1,1),(0,0))'::polygon</ENTRY>
|
<ENTRY>polygon '((0,0),(1,1))' ~= polygon '((1,1),(0,0))'</ENTRY>
|
||||||
</ROW>
|
</ROW>
|
||||||
</TBODY>
|
</TBODY>
|
||||||
</TGROUP>
|
</TGROUP>
|
||||||
@ -2168,7 +2168,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<row>
|
<row>
|
||||||
<entry>area(object)</entry>
|
<entry>area(object)</entry>
|
||||||
<entry>float8</entry>
|
<entry>double precision</entry>
|
||||||
<entry>area of item</entry>
|
<entry>area of item</entry>
|
||||||
<entry>area(box '((0,0),(1,1))')</entry>
|
<entry>area(box '((0,0),(1,1))')</entry>
|
||||||
</row>
|
</row>
|
||||||
@ -2186,13 +2186,13 @@
|
|||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>diameter(circle)</entry>
|
<entry>diameter(circle)</entry>
|
||||||
<entry>float8</entry>
|
<entry>double precision</entry>
|
||||||
<entry>diameter of circle</entry>
|
<entry>diameter of circle</entry>
|
||||||
<entry>diameter(circle '((0,0),2.0)')</entry>
|
<entry>diameter(circle '((0,0),2.0)')</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>height(box)</entry>
|
<entry>height(box)</entry>
|
||||||
<entry>float8</entry>
|
<entry>double precision</entry>
|
||||||
<entry>vertical size of box</entry>
|
<entry>vertical size of box</entry>
|
||||||
<entry>height(box '((0,0),(1,1))')</entry>
|
<entry>height(box '((0,0),(1,1))')</entry>
|
||||||
</row>
|
</row>
|
||||||
@ -2210,7 +2210,7 @@
|
|||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>length(object)</entry>
|
<entry>length(object)</entry>
|
||||||
<entry>float8</entry>
|
<entry>double precision</entry>
|
||||||
<entry>length of item</entry>
|
<entry>length of item</entry>
|
||||||
<entry>length(path '((-1,0),(1,0))')</entry>
|
<entry>length(path '((-1,0),(1,0))')</entry>
|
||||||
</row>
|
</row>
|
||||||
@ -2243,13 +2243,13 @@ Not defined by this name. Implements the intersection operator '#'
|
|||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>radius(circle)</entry>
|
<entry>radius(circle)</entry>
|
||||||
<entry>float8</entry>
|
<entry>double precision</entry>
|
||||||
<entry>radius of circle</entry>
|
<entry>radius of circle</entry>
|
||||||
<entry>radius(circle '((0,0),2.0)')</entry>
|
<entry>radius(circle '((0,0),2.0)')</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>width(box)</entry>
|
<entry>width(box)</entry>
|
||||||
<entry>float8</entry>
|
<entry>double precision</entry>
|
||||||
<entry>horizontal size</entry>
|
<entry>horizontal size</entry>
|
||||||
<entry>width(box '((0,0),(1,1))')</entry>
|
<entry>width(box '((0,0),(1,1))')</entry>
|
||||||
</row>
|
</row>
|
||||||
@ -2274,91 +2274,91 @@ Not defined by this name. Implements the intersection operator '#'
|
|||||||
<entry>box(circle)</entry>
|
<entry>box(circle)</entry>
|
||||||
<entry>box</entry>
|
<entry>box</entry>
|
||||||
<entry>circle to box</entry>
|
<entry>circle to box</entry>
|
||||||
<entry>box('((0,0),2.0)'::circle)</entry>
|
<entry>box(circle '((0,0),2.0)')</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>box(point, point)</entry>
|
<entry>box(point, point)</entry>
|
||||||
<entry>box</entry>
|
<entry>box</entry>
|
||||||
<entry>points to box</entry>
|
<entry>points to box</entry>
|
||||||
<entry>box('(0,0)'::point,'(1,1)'::point)</entry>
|
<entry>box(point '(0,0)', point '(1,1)')</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>box(polygon)</entry>
|
<entry>box(polygon)</entry>
|
||||||
<entry>box</entry>
|
<entry>box</entry>
|
||||||
<entry>polygon to box</entry>
|
<entry>polygon to box</entry>
|
||||||
<entry>box('((0,0),(1,1),(2,0))'::polygon)</entry>
|
<entry>box(polygon '((0,0),(1,1),(2,0))')</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>circle(box)</entry>
|
<entry>circle(box)</entry>
|
||||||
<entry>circle</entry>
|
<entry>circle</entry>
|
||||||
<entry>to circle</entry>
|
<entry>to circle</entry>
|
||||||
<entry>circle('((0,0),(1,1))'::box)</entry>
|
<entry>circle(box '((0,0),(1,1))')</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>circle(point,float8)</entry>
|
<entry>circle(point, double precision)</entry>
|
||||||
<entry>circle</entry>
|
<entry>circle</entry>
|
||||||
<entry>point to circle</entry>
|
<entry>point to circle</entry>
|
||||||
<entry>circle('(0,0)'::point,2.0)</entry>
|
<entry>circle(point '(0,0)', 2.0)</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>lseg(box)</entry>
|
<entry>lseg(box)</entry>
|
||||||
<entry>lseg</entry>
|
<entry>lseg</entry>
|
||||||
<entry>box diagonal to lseg</entry>
|
<entry>box diagonal to lseg</entry>
|
||||||
<entry>lseg('((-1,0),(1,0))'::box)</entry>
|
<entry>lseg(box '((-1,0),(1,0))')</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>lseg(point, point)</entry>
|
<entry>lseg(point, point)</entry>
|
||||||
<entry>lseg</entry>
|
<entry>lseg</entry>
|
||||||
<entry>points to lseg</entry>
|
<entry>points to lseg</entry>
|
||||||
<entry>lseg('(-1,0)'::point,'(1,0)'::point)</entry>
|
<entry>lseg(point '(-1,0)', point '(1,0)')</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>path(polygon)</entry>
|
<entry>path(polygon)</entry>
|
||||||
<entry>point</entry>
|
<entry>point</entry>
|
||||||
<entry>polygon to path</entry>
|
<entry>polygon to path</entry>
|
||||||
<entry>path('((0,0),(1,1),(2,0))'::polygon)</entry>
|
<entry>path(polygon '((0,0),(1,1),(2,0))')</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>point(circle)</entry>
|
<entry>point(circle)</entry>
|
||||||
<entry>point</entry>
|
<entry>point</entry>
|
||||||
<entry>center</entry>
|
<entry>center</entry>
|
||||||
<entry>point('((0,0),2.0)'::circle)</entry>
|
<entry>point(circle '((0,0),2.0)')</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>point(lseg, lseg)</entry>
|
<entry>point(lseg, lseg)</entry>
|
||||||
<entry>point</entry>
|
<entry>point</entry>
|
||||||
<entry>intersection</entry>
|
<entry>intersection</entry>
|
||||||
<entry>point('((-1,0),(1,0))'::lseg, '((-2,-2),(2,2))'::lseg)</entry>
|
<entry>point(lseg '((-1,0),(1,0))', lseg '((-2,-2),(2,2))')</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>point(polygon)</entry>
|
<entry>point(polygon)</entry>
|
||||||
<entry>point</entry>
|
<entry>point</entry>
|
||||||
<entry>center</entry>
|
<entry>center</entry>
|
||||||
<entry>point('((0,0),(1,1),(2,0))'::polygon)</entry>
|
<entry>point(polygon '((0,0),(1,1),(2,0))')</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>polygon(box)</entry>
|
<entry>polygon(box)</entry>
|
||||||
<entry>polygon</entry>
|
<entry>polygon</entry>
|
||||||
<entry>12 point polygon</entry>
|
<entry>12 point polygon</entry>
|
||||||
<entry>polygon('((0,0),(1,1))'::box)</entry>
|
<entry>polygon(box '((0,0),(1,1))')</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>polygon(circle)</entry>
|
<entry>polygon(circle)</entry>
|
||||||
<entry>polygon</entry>
|
<entry>polygon</entry>
|
||||||
<entry>12-point polygon</entry>
|
<entry>12-point polygon</entry>
|
||||||
<entry>polygon('((0,0),2.0)'::circle)</entry>
|
<entry>polygon(circle '((0,0),2.0)')</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>polygon(<replaceable class="parameter">npts</replaceable>, circle)</entry>
|
<entry>polygon(<replaceable class="parameter">npts</replaceable>, circle)</entry>
|
||||||
<entry>polygon</entry>
|
<entry>polygon</entry>
|
||||||
<entry><replaceable class="parameter">npts</replaceable> polygon</entry>
|
<entry><replaceable class="parameter">npts</replaceable> polygon</entry>
|
||||||
<entry>polygon(12,'((0,0),2.0)'::circle)</entry>
|
<entry>polygon(12, circle '((0,0),2.0)')</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry>polygon(path)</entry>
|
<entry>polygon(path)</entry>
|
||||||
<entry>polygon</entry>
|
<entry>polygon</entry>
|
||||||
<entry>path to polygon</entry>
|
<entry>path to polygon</entry>
|
||||||
<entry>polygon('((0,0),(1,1),(2,0))'::path)</entry>
|
<entry>polygon(path '((0,0),(1,1),(2,0))')</entry>
|
||||||
</row>
|
</row>
|
||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/libpq++.sgml,v 1.23 2001/01/13 23:58:55 petere Exp $
|
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/libpq++.sgml,v 1.24 2001/01/20 20:59:28 petere Exp $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<chapter id="libpqplusplus">
|
<chapter id="libpqplusplus">
|
||||||
@ -735,7 +735,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/libpq++.sgml,v 1.23 2001/01/13 23:58:
|
|||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
PgDatabase data;
|
PgDatabase data;
|
||||||
data.Exec("create table foo (a int4, b char(16), d float8)");
|
data.Exec("create table foo (a int4, b char(16), d double precision)");
|
||||||
data.Exec("copy foo from stdin");
|
data.Exec("copy foo from stdin");
|
||||||
data.PutLine("3\tHello World\t4.5\n");
|
data.PutLine("3\tHello World\t4.5\n");
|
||||||
data.PutLine("4\tGoodbye World\t7.11\n");
|
data.PutLine("4\tGoodbye World\t7.11\n");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.56 2001/01/18 07:18:39 thomas Exp $
|
$Header: /cvsroot/pgsql/doc/src/sgml/libpq.sgml,v 1.57 2001/01/20 20:59:28 petere Exp $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<chapter id="libpq-chapter">
|
<chapter id="libpq-chapter">
|
||||||
@ -1685,7 +1685,7 @@ int PQendcopy(PGconn *conn);
|
|||||||
As an example:
|
As an example:
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
PQexec(conn, "create table foo (a int4, b char(16), d float8)");
|
PQexec(conn, "create table foo (a int4, b char(16), d double precision)");
|
||||||
PQexec(conn, "copy foo from stdin");
|
PQexec(conn, "copy foo from stdin");
|
||||||
PQputline(conn, "3\thello world\t4.5\n");
|
PQputline(conn, "3\thello world\t4.5\n");
|
||||||
PQputline(conn,"4\tgoodbye world\t7.11\n");
|
PQputline(conn,"4\tgoodbye world\t7.11\n");
|
||||||
@ -2226,13 +2226,11 @@ main()
|
|||||||
*
|
*
|
||||||
* populate a database by doing the following:
|
* populate a database by doing the following:
|
||||||
*
|
*
|
||||||
* CREATE TABLE test1 (i int4, d float4, p polygon);
|
* CREATE TABLE test1 (i int4, d real, p polygon);
|
||||||
*
|
*
|
||||||
* INSERT INTO test1 values (1, 3.567, '(3.0, 4.0, 1.0,
|
* INSERT INTO test1 values (1, 3.567, polygon '(3.0, 4.0, 1.0, 2.0)');
|
||||||
* 2.0)'::polygon);
|
|
||||||
*
|
*
|
||||||
* INSERT INTO test1 values (2, 89.05, '(4.0, 3.0, 2.0,
|
* INSERT INTO test1 values (2, 89.05, polygon '(4.0, 3.0, 2.0, 1.0)');
|
||||||
* 1.0)'::polygon);
|
|
||||||
*
|
*
|
||||||
* the expected output is:
|
* the expected output is:
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/odbc.sgml,v 1.20 2000/12/22 21:51:58 petere Exp $
|
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/odbc.sgml,v 1.21 2001/01/20 20:59:28 petere Exp $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<chapter id="odbc">
|
<chapter id="odbc">
|
||||||
@ -290,14 +290,6 @@ InstallDir = /opt/applix/axdata/axshlib
|
|||||||
</para>
|
</para>
|
||||||
</tip>
|
</tip>
|
||||||
|
|
||||||
<!--
|
|
||||||
<Para>
|
|
||||||
<Tip>
|
|
||||||
<Para>
|
|
||||||
The <productname>Postgres</productname> datetime type will break MS Access.
|
|
||||||
</Para>
|
|
||||||
</Tip>
|
|
||||||
-->
|
|
||||||
</sect2>
|
</sect2>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/plsql.sgml,v 2.17 2001/01/18 07:11:36 thomas Exp $
|
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/plsql.sgml,v 2.18 2001/01/20 20:59:29 petere Exp $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<chapter id="plsql">
|
<chapter id="plsql">
|
||||||
@ -170,9 +170,9 @@ END;
|
|||||||
must also have a default value specified.
|
must also have a default value specified.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
The default value is evaluated ever time the function is called. So
|
The default value is evaluated every time the function is called. So
|
||||||
assigning '<replaceable>now</replaceable>' to a variable of type
|
assigning '<replaceable>now</replaceable>' to a variable of type
|
||||||
<replaceable>datetime</replaceable> causes the variable to have the
|
<type>timestamp</type> causes the variable to have the
|
||||||
time of the actual function call, not when the function was
|
time of the actual function call, not when the function was
|
||||||
precompiled into its bytecode.
|
precompiled into its bytecode.
|
||||||
</para>
|
</para>
|
||||||
@ -322,7 +322,7 @@ RENAME <replaceable>oldname</replaceable> TO <replaceable>newname</replaceable>;
|
|||||||
All expressions used in PL/pgSQL statements are processed using
|
All expressions used in PL/pgSQL statements are processed using
|
||||||
the backend's executor. Expressions that appear to contain
|
the backend's executor. Expressions that appear to contain
|
||||||
constants may in fact require run-time evaluation (e.g. 'now' for the
|
constants may in fact require run-time evaluation (e.g. 'now' for the
|
||||||
datetime type) so
|
<type>timestamp</type> type) so
|
||||||
it is impossible for the PL/pgSQL parser
|
it is impossible for the PL/pgSQL parser
|
||||||
to identify real constant values other than the NULL keyword. All
|
to identify real constant values other than the NULL keyword. All
|
||||||
expressions are evaluated internally by executing a query
|
expressions are evaluated internally by executing a query
|
||||||
@ -343,7 +343,7 @@ RENAME <replaceable>oldname</replaceable> TO <replaceable>newname</replaceable>;
|
|||||||
is a difference between what the two functions
|
is a difference between what the two functions
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
CREATE FUNCTION logfunc1 (text) RETURNS datetime AS '
|
CREATE FUNCTION logfunc1 (text) RETURNS timestamp AS '
|
||||||
DECLARE
|
DECLARE
|
||||||
logtxt ALIAS FOR $1;
|
logtxt ALIAS FOR $1;
|
||||||
BEGIN
|
BEGIN
|
||||||
@ -356,10 +356,10 @@ CREATE FUNCTION logfunc1 (text) RETURNS datetime AS '
|
|||||||
and
|
and
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
CREATE FUNCTION logfunc2 (text) RETURNS datetime AS '
|
CREATE FUNCTION logfunc2 (text) RETURNS timestamp AS '
|
||||||
DECLARE
|
DECLARE
|
||||||
logtxt ALIAS FOR $1;
|
logtxt ALIAS FOR $1;
|
||||||
curtime datetime;
|
curtime timestamp;
|
||||||
BEGIN
|
BEGIN
|
||||||
curtime := ''now'';
|
curtime := ''now'';
|
||||||
INSERT INTO logtable VALUES (logtxt, curtime);
|
INSERT INTO logtable VALUES (logtxt, curtime);
|
||||||
@ -371,7 +371,7 @@ CREATE FUNCTION logfunc2 (text) RETURNS datetime AS '
|
|||||||
do. In the case of logfunc1(), the <productname>Postgres</productname>
|
do. In the case of logfunc1(), the <productname>Postgres</productname>
|
||||||
main parser
|
main parser
|
||||||
knows when preparing the plan for the INSERT, that the string 'now'
|
knows when preparing the plan for the INSERT, that the string 'now'
|
||||||
should be interpreted as datetime because the target field of logtable
|
should be interpreted as <type>timestamp</type> because the target field of logtable
|
||||||
is of that type. Thus, it will make a constant from it at this time
|
is of that type. Thus, it will make a constant from it at this time
|
||||||
and this constant value is then used in all invocations of logfunc1()
|
and this constant value is then used in all invocations of logfunc1()
|
||||||
during the lifetime of the backend. Needless to say that this isn't what the
|
during the lifetime of the backend. Needless to say that this isn't what the
|
||||||
@ -383,7 +383,7 @@ CREATE FUNCTION logfunc2 (text) RETURNS datetime AS '
|
|||||||
what type 'now' should become and therefore it returns a data type of
|
what type 'now' should become and therefore it returns a data type of
|
||||||
text containing the string 'now'. During the assignment
|
text containing the string 'now'. During the assignment
|
||||||
to the local variable curtime, the PL/pgSQL interpreter casts this
|
to the local variable curtime, the PL/pgSQL interpreter casts this
|
||||||
string to the datetime type by calling the text_out() and datetime_in()
|
string to the timestamp type by calling the text_out() and timestamp_in()
|
||||||
functions for the conversion.
|
functions for the conversion.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
@ -855,7 +855,7 @@ EXIT [ <replaceable>label</replaceable> ] [ WHEN <replaceable>expression</replac
|
|||||||
counterparts from the C language function discussion.
|
counterparts from the C language function discussion.
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
CREATE FUNCTION add_one (int4) RETURNS int4 AS '
|
CREATE FUNCTION add_one (integer) RETURNS integer AS '
|
||||||
BEGIN
|
BEGIN
|
||||||
RETURN $1 + 1;
|
RETURN $1 + 1;
|
||||||
END;
|
END;
|
||||||
@ -881,7 +881,7 @@ CREATE FUNCTION concat_text (text, text) RETURNS text AS '
|
|||||||
The C functions.
|
The C functions.
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
CREATE FUNCTION c_overpaid (EMP, int4) RETURNS bool AS '
|
CREATE FUNCTION c_overpaid (EMP, integer) RETURNS bool AS '
|
||||||
DECLARE
|
DECLARE
|
||||||
emprec ALIAS FOR $1;
|
emprec ALIAS FOR $1;
|
||||||
sallim ALIAS FOR $2;
|
sallim ALIAS FOR $2;
|
||||||
@ -909,9 +909,9 @@ CREATE FUNCTION c_overpaid (EMP, int4) RETURNS bool AS '
|
|||||||
<programlisting>
|
<programlisting>
|
||||||
CREATE TABLE emp (
|
CREATE TABLE emp (
|
||||||
empname text,
|
empname text,
|
||||||
salary int4,
|
salary integer,
|
||||||
last_date datetime,
|
last_date timestamp,
|
||||||
last_user name);
|
last_user text);
|
||||||
|
|
||||||
CREATE FUNCTION emp_stamp () RETURNS OPAQUE AS '
|
CREATE FUNCTION emp_stamp () RETURNS OPAQUE AS '
|
||||||
BEGIN
|
BEGIN
|
||||||
@ -930,7 +930,7 @@ CREATE FUNCTION emp_stamp () RETURNS OPAQUE AS '
|
|||||||
|
|
||||||
-- Remember who changed the payroll when
|
-- Remember who changed the payroll when
|
||||||
NEW.last_date := ''now'';
|
NEW.last_date := ''now'';
|
||||||
NEW.last_user := getpgusername();
|
NEW.last_user := current_user;
|
||||||
RETURN NEW;
|
RETURN NEW;
|
||||||
END;
|
END;
|
||||||
' LANGUAGE 'plpgsql';
|
' LANGUAGE 'plpgsql';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/comment.sgml,v 1.5 2000/12/10 21:56:00 momjian Exp $
|
$Header: /cvsroot/pgsql/doc/src/sgml/ref/comment.sgml,v 1.6 2001/01/20 20:59:29 petere Exp $
|
||||||
Postgres documentation
|
Postgres documentation
|
||||||
-->
|
-->
|
||||||
|
|
||||||
@ -131,8 +131,8 @@ COMMENT ON TABLE my_table IS 'Employee Information';
|
|||||||
COMMENT ON TYPE my_type IS 'Complex Number support';
|
COMMENT ON TYPE my_type IS 'Complex Number support';
|
||||||
COMMENT ON VIEW my_view IS 'View of departmental costs';
|
COMMENT ON VIEW my_view IS 'View of departmental costs';
|
||||||
COMMENT ON COLUMN my_table.my_field IS 'Employee ID number';
|
COMMENT ON COLUMN my_table.my_field IS 'Employee ID number';
|
||||||
COMMENT ON AGGREGATE my_aggregate float8 IS 'Computes sample variance';
|
COMMENT ON AGGREGATE my_aggregate (double precision) IS 'Computes sample variance';
|
||||||
COMMENT ON FUNCTION my_function (datetime) IS 'Returns Roman Numeral';
|
COMMENT ON FUNCTION my_function (timestamp) IS 'Returns Roman Numeral';
|
||||||
COMMENT ON OPERATOR ^ (text, text) IS 'Performs intersection of two text';
|
COMMENT ON OPERATOR ^ (text, text) IS 'Performs intersection of two text';
|
||||||
COMMENT ON TRIGGER my_trigger ON my_table IS 'Used for R.I.';
|
COMMENT ON TRIGGER my_trigger ON my_table IS 'Used for R.I.';
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_aggregate.sgml,v 1.12 2000/10/05 19:48:17 momjian Exp $
|
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_aggregate.sgml,v 1.13 2001/01/20 20:59:29 petere Exp $
|
||||||
Postgres documentation
|
Postgres documentation
|
||||||
-->
|
-->
|
||||||
|
|
||||||
@ -159,8 +159,8 @@ CREATE
|
|||||||
<command>CREATE AGGREGATE</command>
|
<command>CREATE AGGREGATE</command>
|
||||||
allows a user or programmer to extend <productname>Postgres</productname>
|
allows a user or programmer to extend <productname>Postgres</productname>
|
||||||
functionality by defining new aggregate functions. Some aggregate functions
|
functionality by defining new aggregate functions. Some aggregate functions
|
||||||
for base types such as <function>min(int4)</function>
|
for base types such as <function>min(integer)</function>
|
||||||
and <function>avg(float8)</function> are already provided in the base
|
and <function>avg(double precision)</function> are already provided in the base
|
||||||
distribution. If one defines new types or needs an aggregate function not
|
distribution. If one defines new types or needs an aggregate function not
|
||||||
already provided, then <command>CREATE AGGREGATE</command>
|
already provided, then <command>CREATE AGGREGATE</command>
|
||||||
can be used to provide the desired features.
|
can be used to provide the desired features.
|
||||||
|
@ -1053,8 +1053,8 @@
|
|||||||
CREATE TABLE shoelace_log (
|
CREATE TABLE shoelace_log (
|
||||||
sl_name char(10), -- shoelace changed
|
sl_name char(10), -- shoelace changed
|
||||||
sl_avail integer, -- new available value
|
sl_avail integer, -- new available value
|
||||||
log_who name, -- who did it
|
log_who text, -- who did it
|
||||||
log_when datetime -- when
|
log_when timestamp -- when
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE RULE log_shoelace AS ON UPDATE TO shoelace_data
|
CREATE RULE log_shoelace AS ON UPDATE TO shoelace_data
|
||||||
@ -1062,21 +1062,10 @@
|
|||||||
DO INSERT INTO shoelace_log VALUES (
|
DO INSERT INTO shoelace_log VALUES (
|
||||||
NEW.sl_name,
|
NEW.sl_name,
|
||||||
NEW.sl_avail,
|
NEW.sl_avail,
|
||||||
getpgusername(),
|
current_user,
|
||||||
'now'::text
|
current_timestamp
|
||||||
);
|
);
|
||||||
</ProgramListing>
|
</ProgramListing>
|
||||||
|
|
||||||
One interesting detail is the casting of 'now' in the rules
|
|
||||||
INSERT action to type text. Without that, the parser would see
|
|
||||||
at CREATE RULE time, that the target type in <Filename>shoelace_log</Filename>
|
|
||||||
is a datetime and tries to make a constant from it - with success.
|
|
||||||
So a constant datetime value would be stored in the rule action
|
|
||||||
and all log entries would have the time of the CREATE RULE statement.
|
|
||||||
Not exactly what we want. The casting causes the parser to
|
|
||||||
construct a datetime('now'::text) expression and this will be
|
|
||||||
evaluated when the rule is executed. (Another way to do this is to
|
|
||||||
use the function now() instead of a literal constant.)
|
|
||||||
</Para>
|
</Para>
|
||||||
|
|
||||||
<Para>
|
<Para>
|
||||||
@ -1120,7 +1109,7 @@
|
|||||||
<ProgramListing>
|
<ProgramListing>
|
||||||
INSERT INTO shoelace_log VALUES(
|
INSERT INTO shoelace_log VALUES(
|
||||||
*NEW*.sl_name, *NEW*.sl_avail,
|
*NEW*.sl_name, *NEW*.sl_avail,
|
||||||
getpgusername(), datetime('now'::text))
|
current_user, current_timestamp
|
||||||
FROM shoelace_data *NEW*, shoelace_data *OLD*;
|
FROM shoelace_data *NEW*, shoelace_data *OLD*;
|
||||||
</ProgramListing>
|
</ProgramListing>
|
||||||
|
|
||||||
@ -1140,7 +1129,7 @@
|
|||||||
<ProgramListing>
|
<ProgramListing>
|
||||||
INSERT INTO shoelace_log VALUES(
|
INSERT INTO shoelace_log VALUES(
|
||||||
*NEW*.sl_name, *NEW*.sl_avail,
|
*NEW*.sl_name, *NEW*.sl_avail,
|
||||||
getpgusername(), datetime('now'::text))
|
current_user, current_timestamp
|
||||||
FROM shoelace_data *NEW*, shoelace_data *OLD*,
|
FROM shoelace_data *NEW*, shoelace_data *OLD*,
|
||||||
<FirstTerm>shoelace_data shoelace_data</FirstTerm>;
|
<FirstTerm>shoelace_data shoelace_data</FirstTerm>;
|
||||||
</ProgramListing>
|
</ProgramListing>
|
||||||
@ -1151,7 +1140,7 @@
|
|||||||
<ProgramListing>
|
<ProgramListing>
|
||||||
INSERT INTO shoelace_log VALUES(
|
INSERT INTO shoelace_log VALUES(
|
||||||
*NEW*.sl_name, *NEW*.sl_avail,
|
*NEW*.sl_name, *NEW*.sl_avail,
|
||||||
getpgusername(), datetime('now'::text))
|
current_user, current_timestamp
|
||||||
FROM shoelace_data *NEW*, shoelace_data *OLD*,
|
FROM shoelace_data *NEW*, shoelace_data *OLD*,
|
||||||
shoelace_data shoelace_data
|
shoelace_data shoelace_data
|
||||||
<FirstTerm>WHERE int4ne(*NEW*.sl_avail, *OLD*.sl_avail)</FirstTerm>;
|
<FirstTerm>WHERE int4ne(*NEW*.sl_avail, *OLD*.sl_avail)</FirstTerm>;
|
||||||
@ -1169,7 +1158,7 @@
|
|||||||
<ProgramListing>
|
<ProgramListing>
|
||||||
INSERT INTO shoelace_log VALUES(
|
INSERT INTO shoelace_log VALUES(
|
||||||
*NEW*.sl_name, *NEW*.sl_avail,
|
*NEW*.sl_name, *NEW*.sl_avail,
|
||||||
getpgusername(), datetime('now'::text))
|
current_user, current_timestamp
|
||||||
FROM shoelace_data *NEW*, shoelace_data *OLD*,
|
FROM shoelace_data *NEW*, shoelace_data *OLD*,
|
||||||
shoelace_data shoelace_data
|
shoelace_data shoelace_data
|
||||||
WHERE int4ne(*NEW*.sl_avail, *OLD*.sl_avail)
|
WHERE int4ne(*NEW*.sl_avail, *OLD*.sl_avail)
|
||||||
@ -1183,7 +1172,7 @@
|
|||||||
<ProgramListing>
|
<ProgramListing>
|
||||||
INSERT INTO shoelace_log VALUES(
|
INSERT INTO shoelace_log VALUES(
|
||||||
<FirstTerm>shoelace_data.sl_name</FirstTerm>, <FirstTerm>6</FirstTerm>,
|
<FirstTerm>shoelace_data.sl_name</FirstTerm>, <FirstTerm>6</FirstTerm>,
|
||||||
getpgusername(), datetime('now'::text))
|
current_user, current_timestamp
|
||||||
FROM shoelace_data *NEW*, shoelace_data *OLD*,
|
FROM shoelace_data *NEW*, shoelace_data *OLD*,
|
||||||
shoelace_data shoelace_data
|
shoelace_data shoelace_data
|
||||||
WHERE int4ne(<FirstTerm>6</FirstTerm>, *OLD*.sl_avail)
|
WHERE int4ne(<FirstTerm>6</FirstTerm>, *OLD*.sl_avail)
|
||||||
@ -1195,7 +1184,7 @@
|
|||||||
<ProgramListing>
|
<ProgramListing>
|
||||||
INSERT INTO shoelace_log VALUES(
|
INSERT INTO shoelace_log VALUES(
|
||||||
shoelace_data.sl_name, 6,
|
shoelace_data.sl_name, 6,
|
||||||
getpgusername(), datetime('now'::text))
|
current_user, current_timestamp
|
||||||
FROM shoelace_data *NEW*, shoelace_data *OLD*,
|
FROM shoelace_data *NEW*, shoelace_data *OLD*,
|
||||||
shoelace_data shoelace_data
|
shoelace_data shoelace_data
|
||||||
WHERE int4ne(6, <FirstTerm>shoelace_data.sl_avail</FirstTerm>)
|
WHERE int4ne(6, <FirstTerm>shoelace_data.sl_avail</FirstTerm>)
|
||||||
@ -1209,7 +1198,7 @@
|
|||||||
<ProgramListing>
|
<ProgramListing>
|
||||||
INSERT INTO shoelace_log VALUES(
|
INSERT INTO shoelace_log VALUES(
|
||||||
shoelace_data.sl_name, 6,
|
shoelace_data.sl_name, 6,
|
||||||
getpgusername(), datetime('now'::text))
|
current_user, current_timestamp
|
||||||
FROM shoelace_data
|
FROM shoelace_data
|
||||||
WHERE 6 != shoelace_data.sl_avail
|
WHERE 6 != shoelace_data.sl_avail
|
||||||
AND shoelace_data.sl_name = 'sl7';
|
AND shoelace_data.sl_name = 'sl7';
|
||||||
@ -1235,7 +1224,7 @@
|
|||||||
<ProgramListing>
|
<ProgramListing>
|
||||||
INSERT INTO shoelace_log VALUES(
|
INSERT INTO shoelace_log VALUES(
|
||||||
shoelace_data.sl_name, <FirstTerm>shoelace_data.sl_avail</FirstTerm>,
|
shoelace_data.sl_name, <FirstTerm>shoelace_data.sl_avail</FirstTerm>,
|
||||||
getpgusername(), 'now')
|
current_user, current_timestamp)
|
||||||
FROM shoelace_data
|
FROM shoelace_data
|
||||||
WHERE <FirstTerm>shoelace_data.sl_avail</FirstTerm> != shoelace_data.sl_avail
|
WHERE <FirstTerm>shoelace_data.sl_avail</FirstTerm> != shoelace_data.sl_avail
|
||||||
AND shoelace_data.sl_name = 'sl7';
|
AND shoelace_data.sl_name = 'sl7';
|
||||||
@ -1258,7 +1247,7 @@
|
|||||||
<ProgramListing>
|
<ProgramListing>
|
||||||
INSERT INTO shoelace_log SELECT
|
INSERT INTO shoelace_log SELECT
|
||||||
shoelace_data.sl_name, 0,
|
shoelace_data.sl_name, 0,
|
||||||
getpgusername(), 'now'
|
current_user, current_timestamp
|
||||||
FROM shoelace_data
|
FROM shoelace_data
|
||||||
WHERE 0 != shoelace_data.sl_avail
|
WHERE 0 != shoelace_data.sl_avail
|
||||||
AND <FirstTerm>shoelace_data.sl_color = 'black'</FirstTerm>;
|
AND <FirstTerm>shoelace_data.sl_color = 'black'</FirstTerm>;
|
||||||
@ -1512,8 +1501,8 @@
|
|||||||
INSERT INTO shoelace_log SELECT
|
INSERT INTO shoelace_log SELECT
|
||||||
s.sl_name,
|
s.sl_name,
|
||||||
int4pl(s.sl_avail, shoelace_arrive.arr_quant),
|
int4pl(s.sl_avail, shoelace_arrive.arr_quant),
|
||||||
getpgusername(),
|
current_user,
|
||||||
datetime('now'::text)
|
current_timestamp
|
||||||
FROM shoelace_arrive shoelace_arrive, shoelace_ok shoelace_ok,
|
FROM shoelace_arrive shoelace_arrive, shoelace_ok shoelace_ok,
|
||||||
shoelace_ok *OLD*, shoelace_ok *NEW*,
|
shoelace_ok *OLD*, shoelace_ok *NEW*,
|
||||||
shoelace shoelace, shoelace *OLD*,
|
shoelace shoelace, shoelace *OLD*,
|
||||||
@ -1537,8 +1526,8 @@
|
|||||||
INSERT INTO shoelace_log SELECT
|
INSERT INTO shoelace_log SELECT
|
||||||
s.sl_name,
|
s.sl_name,
|
||||||
s.sl_avail + shoelace_arrive.arr_quant,
|
s.sl_avail + shoelace_arrive.arr_quant,
|
||||||
getpgusername(),
|
current_user,
|
||||||
'now'
|
current_timestamp
|
||||||
FROM shoelace_arrive shoelace_arrive, shoelace_data shoelace_data,
|
FROM shoelace_arrive shoelace_arrive, shoelace_data shoelace_data,
|
||||||
shoelace_data s
|
shoelace_data s
|
||||||
WHERE s.sl_name = shoelace_arrive.arr_name
|
WHERE s.sl_name = shoelace_arrive.arr_name
|
||||||
|
@ -307,7 +307,8 @@ then fail.
|
|||||||
|
|
||||||
<para>
|
<para>
|
||||||
There is only one exponentiation
|
There is only one exponentiation
|
||||||
operator defined in the catalog, and it takes <type>float8</type> arguments.
|
operator defined in the catalog, and it takes arguments of type
|
||||||
|
<type>double precision</type>.
|
||||||
The scanner assigns an initial type of <type>int4</type> to both arguments
|
The scanner assigns an initial type of <type>int4</type> to both arguments
|
||||||
of this query expression:
|
of this query expression:
|
||||||
<programlisting>
|
<programlisting>
|
||||||
@ -322,7 +323,7 @@ So the parser does a type conversion on both operands and the query
|
|||||||
is equivalent to
|
is equivalent to
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
tgl=> select float8(2) ^ float8(3) AS "Exp";
|
tgl=> select CAST(2 AS double precision) ^ CAST(3 AS double precision) AS "Exp";
|
||||||
Exp
|
Exp
|
||||||
-----
|
-----
|
||||||
8
|
8
|
||||||
@ -754,8 +755,8 @@ Here, the unknown-type literal 'b' will be resolved as type text.
|
|||||||
|
|
||||||
<para>
|
<para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
tgl=> SELECT 1.2 AS "Float8" UNION SELECT 1;
|
tgl=> SELECT 1.2 AS "Double" UNION SELECT 1;
|
||||||
Float8
|
Double
|
||||||
--------
|
--------
|
||||||
1
|
1
|
||||||
1.2
|
1.2
|
||||||
@ -773,7 +774,7 @@ the first/top clause in the union:
|
|||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
tgl=> SELECT 1 AS "All integers"
|
tgl=> SELECT 1 AS "All integers"
|
||||||
tgl-> UNION SELECT '2.2'::float4;
|
tgl-> UNION SELECT CAST('2.2' AS REAL);
|
||||||
All integers
|
All integers
|
||||||
--------------
|
--------------
|
||||||
1
|
1
|
||||||
@ -782,8 +783,9 @@ tgl-> UNION SELECT '2.2'::float4;
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Since float4 is not a preferred type, the parser sees no reason to select it
|
Since <type>REAL</type> is not a preferred type, the parser sees no reason
|
||||||
over int4, and instead falls back on the use-the-first-alternative rule.
|
to select it over <type>INTEGER</type> (which is what the 1 is), and instead
|
||||||
|
falls back on the use-the-first-alternative rule.
|
||||||
This example demonstrates that the preferred-type mechanism doesn't encode
|
This example demonstrates that the preferred-type mechanism doesn't encode
|
||||||
as much information as we'd like. Future versions of
|
as much information as we'd like. Future versions of
|
||||||
<productname>Postgres</productname> may support a more general notion of
|
<productname>Postgres</productname> may support a more general notion of
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$Header: /cvsroot/pgsql/doc/src/sgml/xfunc.sgml,v 1.28 2001/01/13 23:58:55 petere Exp $
|
$Header: /cvsroot/pgsql/doc/src/sgml/xfunc.sgml,v 1.29 2001/01/20 20:59:29 petere Exp $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<chapter id="xfunc">
|
<chapter id="xfunc">
|
||||||
@ -186,7 +186,7 @@ CREATE FUNCTION double_salary(EMP)
|
|||||||
|
|
||||||
SELECT name, double_salary(EMP) AS dream
|
SELECT name, double_salary(EMP) AS dream
|
||||||
FROM EMP
|
FROM EMP
|
||||||
WHERE EMP.cubicle ~= '(2,1)'::point;
|
WHERE EMP.cubicle ~= point '(2,1)';
|
||||||
|
|
||||||
|
|
||||||
+-----+-------+
|
+-----+-------+
|
||||||
@ -231,10 +231,10 @@ SELECT name(EMP) AS youngster
|
|||||||
<programlisting>
|
<programlisting>
|
||||||
CREATE FUNCTION new_emp()
|
CREATE FUNCTION new_emp()
|
||||||
RETURNS EMP
|
RETURNS EMP
|
||||||
AS 'SELECT \'None\'::text AS name,
|
AS 'SELECT text ''None'' AS name,
|
||||||
1000 AS salary,
|
1000 AS salary,
|
||||||
25 AS age,
|
25 AS age,
|
||||||
\'(2,2)\'::point AS cubicle'
|
point ''(2,2)'' AS cubicle'
|
||||||
LANGUAGE 'sql';
|
LANGUAGE 'sql';
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
@ -255,7 +255,7 @@ CREATE FUNCTION new_emp()
|
|||||||
</listitem>
|
</listitem>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
You must typecast the expressions (using ::) to match the
|
You must typecast the expressions to match the
|
||||||
composite type's definition, or you will get errors like this:
|
composite type's definition, or you will get errors like this:
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<computeroutput>
|
<computeroutput>
|
||||||
@ -1186,7 +1186,7 @@ LANGUAGE 'c';
|
|||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
Compiling and loading your object code so that
|
Compiling and linking your object code so that
|
||||||
it can be dynamically loaded into
|
it can be dynamically loaded into
|
||||||
<productname>Postgres</productname>
|
<productname>Postgres</productname>
|
||||||
always requires special flags.
|
always requires special flags.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user