11.\" This is -*-nroff-*-
22.\" XXX standard disclaimer belongs here....
3- .\" $Header: /cvsroot/pgsql/src/man/Attic/pgbuiltin.3,v 1.9 1997/11/17 22:15:03 momjian Exp $
3+ .\" $Header: /cvsroot/pgsql/src/man/Attic/pgbuiltin.3,v 1.10 1997/11/18 23:04:27 momjian Exp $
44.TH PGBUILTIN INTRO 04/01/97 PostgreSQL PostgreSQL
5+ .PP
56.SH "DESCRIPTION"
67This section describes the data types, functions and operators
78available to users in Postgres as it is distributed.
9+ .PP
810.SH "PGBUILTIN TYPES"
9- This section describes
10- .BR pgbuiltin
11- data types.
12- These Built-in types are installed in every database.
11+ Built-in types are installed in every database.
12+ .IR " psql"
13+ has a \e d command to show these types.
1314.PP
1415Users may add new types to Postgres using the
1516.IR " define type"
16- command described in this manual. User-defined types are not
17- described in this section.
18- .SH "List of built-in types"
19- .PP
20- .if n .ta 5 +15 +40
21- .if t .ta 0.5i +1.5i +3.0i
22- .in 0
23- .nf
24- \fB POSTGRES Type \fP \fB Meaning \fP
25- abstime (absolute) limited-range date and time
26- aclitem access control list item
27- bool boolean
28- box 2-dimensional rectangle
29- bpchar blank-padded characters
30- bytea variable length array of bytes
31- char character
32- char2 array of 2 characters
33- char4 array of 4 characters
34- char8 array of 8 characters
35- char16 array of 16 characters
36- cid command identifier type
37- date ANSI SQL date type
38- datetime general-use date and time
39- filename large object filename
40- int2 two-byte signed integer
41- int28 array of 8 int2
42- int4 four-byte signed integer
43- float4 single-precision floating-point number
44- float8 double-precision floating-point number
45- lseg 2-dimensional line segment
46- money decimal type with fixed precision
47- name a multi-character type for storing system identifiers
48- oid object identifier type
49- oid8 array of 8 oid
50- oidchar16 oid and char16 composed
51- oidint2 oid and int2 composed
52- oidint4 oid and int4 composed
53- path open or closed line segments
54- point 2-dimensional geometric point
55- polygon 2-dimensional polygon (same as a closed path)
56- circle 2-dimensional circle (center and radius)
57- regproc registered procedure
58- reltime (relative) date and time span (duration)
59- smgr storage manager
60- text variable length array of characters
61- tid tuple identifier type
62- time ANSI SQL time type
63- timespan general-use time span (duration)
64- timestamp limited-range ISO-format date and time
65- tinterval time interval (start and stop abstime)
66- varchar variable-length characters
67- xid transaction identifier type
68-
69- .fi
70- .in
17+ command described in this manual.
7118.PP
7219There are some data types defined by SQL/92 syntax which are mapped directly
7320into native Postgres types. Note that the "exact numerics"
7623.IR numeric
7724have fully implemented syntax but currently (postgres v6.2) support only a limited
7825range of the values allowed by SQL/92.
79-
26+ . PP
8027.SH "List of SQL/92 types"
8128.PP
82- .if n .ta 5 +15 +25 +40
29+ .if n .ta 2 +15 +25 +40
8330.if t .ta 0.5i +1.5i +3.0i
8431.in 0
8532.nf
@@ -101,9 +48,10 @@ range of the values allowed by SQL/92.
10148.in
10249.PP
10350There are some constants and functions defined in SQL/92.
51+ .PP
10452.SH "List of SQL/92 constants"
10553.PP
106- .if n .ta 5 +20 +40
54+ .if n .ta 2 +20 +40
10755.if t .ta 0.5i +1.5i +3.0i +4.0i
10856.in 0
10957.nf
@@ -118,7 +66,7 @@ There are some constants and functions defined in SQL/92.
11866Many of the built-in types have obvious external formats. However, several
11967types are either unique to Postgres, such as open and closed paths, or have
12068several possibilities for formats, such as date and time types.
121-
69+ . PP
12270.SH "Syntax of date and time types"
12371Most date and time types share code for data input. For those types (
12472.IR datetime ,
@@ -145,7 +93,7 @@ In future releases, the number of date/time types will decrease, with the curren
14593implementation of datetime becoming timestamp, timespan becoming interval,
14694and (possibly) abstime
14795and reltime being deprecated in favor of timestamp and interval.
148-
96+ . PP
14997.SH "DATETIME"
15098General-use date and time is input using a wide range of
15199styles, including ISO-compatible, SQL-compatible, traditional
@@ -196,7 +144,7 @@ and `epoch' can be used to specify
196144time values. `now' means the current time, and differs from
197145`current' in that the current time is immediately substituted
198146for it. `epoch' means Jan 1 00:00:00 1970 GMT.
199-
147+ . PP
200148.SH "TIMESPAN"
201149General-use time span is input using a wide range of
202150syntaxes, including ISO-compatible, SQL-compatible, traditional
@@ -221,6 +169,7 @@ where
221169 or abbreviations or plurals of these units.
222170 Direction is `ago'.
223171.fi
172+ .PP
224173.SH "ABSOLUTE TIME"
225174Absolute time (abstime) is a limited-range (+/- 68 years) and limited-precision (1 sec)
226175date data type.
@@ -251,7 +200,7 @@ All special values allowed for
251200.IR " datetime"
252201are also allowed for
253202.IR " absolute time" .
254-
203+ . PP
255204.SH "RELATIVE TIME"
256205Relative time (reltime) is a limited-range (+/- 68 years) and limited-precision (1 sec)
257206time span data type.
@@ -279,7 +228,7 @@ where
279228Valid relative times are less than or equal to 68 years.)
280229In addition, the special relative time \*( lq Undefined RelTime\*( rq is
281230provided.
282-
231+ . PP
283232.SH "TIMESTAMP"
284233This is currently a limited-range absolute time which closely resembles the
285234.IR abstime
@@ -289,7 +238,7 @@ and will move toward SQL92 compliance.
289238
290239.PP
291240timestamp is specified using the same syntax as for datetime.
292-
241+ . PP
293242.SH "TIME RANGES"
294243Time ranges are specified as:
295244.PP
@@ -300,7 +249,7 @@ where
300249.IR abstime
301250is a time in the absolute time format. Special abstime values such as
302251\*( lq current\*( rq , \*( lq infinity\*( rq and \*( lq -infinity\*( rq can be used.
303-
252+ . PP
304253.SH "Syntax of geometric types"
305254.SH "POINT"
306255Points are specified using the following syntax:
@@ -353,6 +302,7 @@ The corners are reordered on input to store
353302the lower left corner first and the upper right corner last.
354303Other corners of the box can be entered, but the lower
355304left and upper right corners are determined from the input and stored.
305+ .PP
356306.SH "PATH"
357307Paths are represented by sets of points. Paths can be "open", where
358308the first and last points in the set are not connected, and "closed",
@@ -391,7 +341,7 @@ v6.1 used a format for paths which had a single leading parenthesis, a "closed"
391341an integer count of the number of points, then the list of points followed by a
392342closing parenthesis. The built-in function upgradepath() is supplied to convert
393343paths dumped and reloaded from pre-v6.1 databases.
394-
344+ . PP
395345.SH "POLYGON"
396346Polygons are represented by sets of points. Polygons should probably be
397347considered
@@ -423,7 +373,7 @@ v6.1 used a format for polygons which had a single leading parenthesis, the list
423373of x-axis coordinates, the list of y-axis coordinates, followed by a closing parenthesis.
424374The built-in function upgradepoly() is supplied to convert
425375polygons dumped and reloaded from pre-v6.1 databases.
426-
376+ . PP
427377.SH "CIRCLE"
428378Circles are represented by a center point and a radius.
429379.PP
@@ -444,138 +394,35 @@ where
444394.fi
445395.PP
446396Circles are output using the first syntax.
447-
397+ . PP
448398.SH "Built-in operators and functions"
449399.SH OPERATORS
450400Postgres provides a large number of built-in operators on system types.
451401These operators are declared in the system catalog
452402\*( lq pg_operator\*( rq . Every entry in \*( lq pg_operator\*( rq includes
453403the object ID of the procedure that implements the operator.
454404.PP
455- Users may invoke operators using the operator name, as in
405+ Users may invoke operators using the operator name, as in:
406+ .PP
407+ .in 1i
456408.nf
457409select * from emp where salary < 40000;
458410.fi
411+ .in
412+ .PP
459413Alternatively, users may call the functions that implement the
460414operators directly. In this case, the query above would be expressed
461- as
415+ as:
416+ .PP
417+ .in 1i
462418.nf
463419select * from emp where int4lt(salary, 40000);
464420.fi
465- The rest of this section provides a list of the built-in operators and
466- the functions that implement them. Binary operators are listed first,
467- followed by unary operators.
468-
469- .nf
470- Operators:
471-
472- general
473- <\(eq less or equal
474- <> inequality
475- < less than
476- <\(eq greater or equal
477- >\(eq greater or equal
478- > greater than
479- \(eq equality
480- ~ A matches regular expression B, case-sensitive
481- !~ A does not match regular expression B, case-sensitive
482- ~* A matches regular expression B, case-insensitive.
483- !~* A does not match regular expression B, case-insensitive
484- ~~ A matches LIKE expression B, case-sensitive
485- !~~ A does not match LIKE expression B, case-sensitive
486-
487- + addition
488- \(mi subtraction
489- * multiplication
490- / division
491- % modulus
492- @ absolute value
493-
494- geometric
495- @ A contained by (inside or on) B
496- ~ A contains (around or on) B
497- @@ center of object
498- <-> distance between A and B
499- && objects overlap
500- &< A overlaps B, but does not extend to right of B
501- &> A overlaps B, but does not extend to left of B
502- << A is left of B
503- >> A is right of B
504- >^ A is above B
505- <^ A is below B
506-
507- float8
508- ^ exponentiation
509- % truncate to integer
510- |/ square root
511- ||/ cube root
512- : exponential function
513- ; natural logarithm (in psql, protect with parentheses)
514-
515- point
516- << A is left of B
517- >> A is right of B
518- >^ A is above B
519- <^ A is below B
520- ~\(eq A same as B (equality)
521- @ point inside (or on) path, box, circle, polygon
522-
523- box
524- && boxes overlap
525- &< box A overlaps box B, but does not extend to right of box B
526- &> box A overlaps box B, but does not extend to left of box B
527- << A is left of B
528- >> A is right of B
529- >^ A is above B
530- <^ A is below B
531- \(eq area equal
532- < area less than
533- <\(eq area less or equal
534- >\(eq area greater or equal
535- > area greater than
536- ~\(eq A same as B (equality)
537- @ A is contained in B
538- ~ A contains B
539- @@ center of box
540-
541- polygon
542- && polygons overlap
543- &< A overlaps B but does not extend to right of B
544- &> A overlaps B but does not extend to left of B
545- << A is left of B
546- >> A is right of B
547- ~\(eq A same as B (equality)
548- @ A is contained by B
549- ~ A contains B
550-
551- circle
552- && circles overlap
553- &< A overlaps B but does not extend to right of B
554- &> A overlaps B but does not extend to left of B
555- << A is left of B
556- >> A is right of B
557- >^ A is above B
558- <^ A is below B
559- ~\(eq A same as B (equality)
560- @ A is contained by B
561- ~ A contains B
562-
563- tinterval
564- #<\(eq interval length less or equal reltime
565- #<> interval length not equal to reltime.
566- #< interval length less than reltime
567- #\(eq interval length equal to reltime
568- #>\(eq interval length greater or equal reltime
569- #> interval length greater than reltime
570- && intervals overlap
571- << A contains B
572- \(eq equality
573- <> interval bounded by two abstimes
574- <?> abstime in tinterval
575- | start of interval
576- <#> convert to interval
577- .fi
578-
421+ .in
422+ .PP
423+ .IR " psql"
424+ has a \e d command to show these operators.
425+ .PP
579426.SH "FUNCTIONS"
580427Many data types have functions available for conversion to other related types.
581428In addition, there are some type-specific functions. Functions which are also
@@ -672,24 +519,23 @@ text
672519 trim characters from text
673520
674521.fi
675-
676- .SH "PSQL HELP "
677- .IR " psq "
522+ . PP
523+ .SH "ADDITIONAL INFORMATION "
524+ .IR " psql "
678525has a variety of \e d commands for showing system information.
679526Consult those
680527.IR " psql"
681528commands for more listings.
682-
683- .in
529+ .PP
684530.SH "SEE ALSO"
685531.IR set (l),
686532.IR show (l),
687533.IR reset (l),
688534.IR psql (1).
689535For examples on specifying literals of built-in types, see
690536.IR SQL (l).
691- .SH BUGS
692537.PP
538+ .SH BUGS
693539Although most of the input and output functions corresponding to the
694540base types (e.g., integers and floating point numbers) do some
695541error-checking, some are not particularly rigorous about it. More
0 commit comments