1
1
.\" This is -*-nroff-*-
2
2
.\" 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 $
4
4
.TH PGBUILTIN INTRO 04/01/97 PostgreSQL PostgreSQL
5
+ .PP
5
6
.SH "DESCRIPTION"
6
7
This section describes the data types, functions and operators
7
8
available to users in Postgres as it is distributed.
9
+ .PP
8
10
.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.
13
14
.PP
14
15
Users may add new types to Postgres using the
15
16
.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.
71
18
.PP
72
19
There are some data types defined by SQL/92 syntax which are mapped directly
73
20
into native Postgres types. Note that the "exact numerics"
76
23
.IR numeric
77
24
have fully implemented syntax but currently (postgres v6.2) support only a limited
78
25
range of the values allowed by SQL/92.
79
-
26
+ . PP
80
27
.SH "List of SQL/92 types"
81
28
.PP
82
- .if n .ta 5 +15 +25 +40
29
+ .if n .ta 2 +15 +25 +40
83
30
.if t .ta 0.5i +1.5i +3.0i
84
31
.in 0
85
32
.nf
@@ -101,9 +48,10 @@ range of the values allowed by SQL/92.
101
48
.in
102
49
.PP
103
50
There are some constants and functions defined in SQL/92.
51
+ .PP
104
52
.SH "List of SQL/92 constants"
105
53
.PP
106
- .if n .ta 5 +20 +40
54
+ .if n .ta 2 +20 +40
107
55
.if t .ta 0.5i +1.5i +3.0i +4.0i
108
56
.in 0
109
57
.nf
@@ -118,7 +66,7 @@ There are some constants and functions defined in SQL/92.
118
66
Many of the built-in types have obvious external formats. However, several
119
67
types are either unique to Postgres, such as open and closed paths, or have
120
68
several possibilities for formats, such as date and time types.
121
-
69
+ . PP
122
70
.SH "Syntax of date and time types"
123
71
Most date and time types share code for data input. For those types (
124
72
.IR datetime ,
@@ -145,7 +93,7 @@ In future releases, the number of date/time types will decrease, with the curren
145
93
implementation of datetime becoming timestamp, timespan becoming interval,
146
94
and (possibly) abstime
147
95
and reltime being deprecated in favor of timestamp and interval.
148
-
96
+ . PP
149
97
.SH "DATETIME"
150
98
General-use date and time is input using a wide range of
151
99
styles, including ISO-compatible, SQL-compatible, traditional
@@ -196,7 +144,7 @@ and `epoch' can be used to specify
196
144
time values. `now' means the current time, and differs from
197
145
`current' in that the current time is immediately substituted
198
146
for it. `epoch' means Jan 1 00:00:00 1970 GMT.
199
-
147
+ . PP
200
148
.SH "TIMESPAN"
201
149
General-use time span is input using a wide range of
202
150
syntaxes, including ISO-compatible, SQL-compatible, traditional
@@ -221,6 +169,7 @@ where
221
169
or abbreviations or plurals of these units.
222
170
Direction is `ago'.
223
171
.fi
172
+ .PP
224
173
.SH "ABSOLUTE TIME"
225
174
Absolute time (abstime) is a limited-range (+/- 68 years) and limited-precision (1 sec)
226
175
date data type.
@@ -251,7 +200,7 @@ All special values allowed for
251
200
.IR " datetime"
252
201
are also allowed for
253
202
.IR " absolute time" .
254
-
203
+ . PP
255
204
.SH "RELATIVE TIME"
256
205
Relative time (reltime) is a limited-range (+/- 68 years) and limited-precision (1 sec)
257
206
time span data type.
@@ -279,7 +228,7 @@ where
279
228
Valid relative times are less than or equal to 68 years.)
280
229
In addition, the special relative time \*( lq Undefined RelTime\*( rq is
281
230
provided.
282
-
231
+ . PP
283
232
.SH "TIMESTAMP"
284
233
This is currently a limited-range absolute time which closely resembles the
285
234
.IR abstime
@@ -289,7 +238,7 @@ and will move toward SQL92 compliance.
289
238
290
239
.PP
291
240
timestamp is specified using the same syntax as for datetime.
292
-
241
+ . PP
293
242
.SH "TIME RANGES"
294
243
Time ranges are specified as:
295
244
.PP
@@ -300,7 +249,7 @@ where
300
249
.IR abstime
301
250
is a time in the absolute time format. Special abstime values such as
302
251
\*( lq current\*( rq , \*( lq infinity\*( rq and \*( lq -infinity\*( rq can be used.
303
-
252
+ . PP
304
253
.SH "Syntax of geometric types"
305
254
.SH "POINT"
306
255
Points are specified using the following syntax:
@@ -353,6 +302,7 @@ The corners are reordered on input to store
353
302
the lower left corner first and the upper right corner last.
354
303
Other corners of the box can be entered, but the lower
355
304
left and upper right corners are determined from the input and stored.
305
+ .PP
356
306
.SH "PATH"
357
307
Paths are represented by sets of points. Paths can be "open", where
358
308
the 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"
391
341
an integer count of the number of points, then the list of points followed by a
392
342
closing parenthesis. The built-in function upgradepath() is supplied to convert
393
343
paths dumped and reloaded from pre-v6.1 databases.
394
-
344
+ . PP
395
345
.SH "POLYGON"
396
346
Polygons are represented by sets of points. Polygons should probably be
397
347
considered
@@ -423,7 +373,7 @@ v6.1 used a format for polygons which had a single leading parenthesis, the list
423
373
of x-axis coordinates, the list of y-axis coordinates, followed by a closing parenthesis.
424
374
The built-in function upgradepoly() is supplied to convert
425
375
polygons dumped and reloaded from pre-v6.1 databases.
426
-
376
+ . PP
427
377
.SH "CIRCLE"
428
378
Circles are represented by a center point and a radius.
429
379
.PP
@@ -444,138 +394,35 @@ where
444
394
.fi
445
395
.PP
446
396
Circles are output using the first syntax.
447
-
397
+ . PP
448
398
.SH "Built-in operators and functions"
449
399
.SH OPERATORS
450
400
Postgres provides a large number of built-in operators on system types.
451
401
These operators are declared in the system catalog
452
402
\*( lq pg_operator\*( rq . Every entry in \*( lq pg_operator\*( rq includes
453
403
the object ID of the procedure that implements the operator.
454
404
.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
456
408
.nf
457
409
select * from emp where salary < 40000;
458
410
.fi
411
+ .in
412
+ .PP
459
413
Alternatively, users may call the functions that implement the
460
414
operators directly. In this case, the query above would be expressed
461
- as
415
+ as:
416
+ .PP
417
+ .in 1i
462
418
.nf
463
419
select * from emp where int4lt(salary, 40000);
464
420
.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
579
426
.SH "FUNCTIONS"
580
427
Many data types have functions available for conversion to other related types.
581
428
In addition, there are some type-specific functions. Functions which are also
@@ -672,24 +519,23 @@ text
672
519
trim characters from text
673
520
674
521
.fi
675
-
676
- .SH "PSQL HELP "
677
- .IR " psq "
522
+ . PP
523
+ .SH "ADDITIONAL INFORMATION "
524
+ .IR " psql "
678
525
has a variety of \e d commands for showing system information.
679
526
Consult those
680
527
.IR " psql"
681
528
commands for more listings.
682
-
683
- .in
529
+ .PP
684
530
.SH "SEE ALSO"
685
531
.IR set (l),
686
532
.IR show (l),
687
533
.IR reset (l),
688
534
.IR psql (1).
689
535
For examples on specifying literals of built-in types, see
690
536
.IR SQL (l).
691
- .SH BUGS
692
537
.PP
538
+ .SH BUGS
693
539
Although most of the input and output functions corresponding to the
694
540
base types (e.g., integers and floating point numbers) do some
695
541
error-checking, some are not particularly rigorous about it. More
0 commit comments