1
1
.\" This is -*-nroff-*-
2
2
.\" XXX standard disclaimer belongs here....
3
- .\" $Header: /cvsroot/pgsql/src/man/Attic/pgbuiltin.3,v 1.4 1997/09/16 03:01:43 momjian Exp $
3
+ .\" $Header: /cvsroot/pgsql/src/man/Attic/pgbuiltin.3,v 1.5 1997/09/27 04:37:33 thomas Exp $
4
4
.TH PGBUILTIN INTRO 04/01/97 PostgreSQL PostgreSQL
5
5
.SH "DESCRIPTION"
6
6
This section describes the data types, functions and operators
@@ -37,12 +37,9 @@ described in this section.
37
37
date ANSI SQL date type
38
38
datetime general-use date and time
39
39
filename large object filename
40
- int alias for int4
41
- integer alias for int4
42
40
int2 two-byte signed integer
43
41
int28 array of 8 int2
44
42
int4 four-byte signed integer
45
- float alias for float4
46
43
float4 single-precision floating-point number
47
44
float8 double-precision floating-point number
48
45
lseg 2-dimensional line segment
@@ -57,11 +54,9 @@ described in this section.
57
54
point 2-dimensional geometric point
58
55
polygon 2-dimensional polygon (same as a closed path)
59
56
circle 2-dimensional circle (center and radius)
60
- real alias for float4
61
57
regproc registered procedure
62
58
reltime (relative) date and time span (duration)
63
59
smgr storage manager
64
- smallint alias for int2
65
60
text variable length array of characters
66
61
tid tuple identifier type
67
62
time ANSI SQL time type
@@ -71,6 +66,52 @@ described in this section.
71
66
varchar variable-length characters
72
67
xid transaction identifier type
73
68
69
+ .fi
70
+ .in
71
+ .PP
72
+ There are some data types defined by SQL/92 syntax which are mapped directly
73
+ into native Postgres types. Note that the "exact numerics"
74
+ .IR decimal
75
+ and
76
+ .IR numeric
77
+ have fully implemented syntax but currently (postgres v6.2) support only a limited
78
+ range of the values allowed by SQL/92.
79
+
80
+ .SH "List of SQL/92 types"
81
+ .PP
82
+ .if n .ta 5 +15 +25 +40
83
+ .if t .ta 0.5i +1.5i +3.0i
84
+ .in 0
85
+ .nf
86
+ \fB POSTGRES Type \fP \fB SQL/92 Type \fP \fB Meaning \fP
87
+ char(n) character(n) fixed-length character string
88
+ varchar(n) character varying(n) variable-length character string
89
+ float4/8 float(p) floating-point number with precision p
90
+ float8 double precision double-precision floating-point number
91
+ float8 real double-precision floating-point number
92
+ int2 smallint signed two-byte integer
93
+ int4 int signed 4-byte integer
94
+ int4 integer signed 4-byte integer
95
+ int4 decimal(p,s) exact numeric for p <= 9, s = 0
96
+ int4 numeric(p,s) exact numeric for p == 9, s = 0
97
+ timestamp timestamp with time zone date/time
98
+ timespan interval general-use time span
99
+
100
+ .fi
101
+ .in
102
+ .PP
103
+ There are some constants and functions defined in SQL/92.
104
+ .SH "List of SQL/92 constants"
105
+ .PP
106
+ .if n .ta 5 +20 +40
107
+ .if t .ta 0.5i +1.5i +3.0i +4.0i
108
+ .in 0
109
+ .nf
110
+ \fB SQL/92 Function \fP \fB Meaning \fP
111
+ current_date date of current transaction
112
+ current_time time of current transaction
113
+ current_timestamp date and time of current transaction
114
+
74
115
.fi
75
116
.in
76
117
.PP
@@ -83,8 +124,11 @@ Most date and time types share code for data input. For those types (
83
124
.IR datetime ,
84
125
.IR abstime ,
85
126
.IR timestamp ,
86
- .IR timespan and
87
- .IR reltime )
127
+ .IR timespan ,
128
+ .IR reltime ,
129
+ .IR date ,
130
+ and
131
+ .IR time )
88
132
the input can have any of a wide variety of styles. For numeric date representations,
89
133
European and US conventions can differ, and the proper interpretation is obtained
90
134
by using the
@@ -97,6 +141,11 @@ Postgres (see section on
97
141
with the SQL style having European and US variants (see
98
142
.IR set (l)).
99
143
144
+ In future releases, the number of date/time types will decrease, with the current
145
+ implementation of datetime becoming timestamp, timespan becoming interval,
146
+ and (possibly) abstime
147
+ and reltime being deprecated in favor of timestamp and interval.
148
+
100
149
.SH "DATETIME"
101
150
General-use date and time is input using a wide range of
102
151
styles, including ISO-compatible, SQL-compatible, traditional
@@ -531,7 +580,11 @@ tinterval
531
580
532
581
.SH "FUNCTIONS"
533
582
Many data types have functions available for conversion to other related types.
534
- In addition, there are some type-specific functions.
583
+ In addition, there are some type-specific functions. Functions which are also
584
+ available through operators are documented as operators only.
585
+
586
+ .PP
587
+ Some functions defined for text are also available for char() and varchar().
535
588
.PP
536
589
For the
537
590
date_part() and date_trunc()
@@ -546,6 +599,23 @@ to return day of week and `epoch' to return seconds since 1970.
546
599
.nf
547
600
Functions:
548
601
602
+ integer
603
+ float8 float(int) convert integer to floating point
604
+ float4 float4(int) convert integer to floating point
605
+
606
+ float
607
+ int integer(float) convert floating point to integer
608
+
609
+ text
610
+ text lower(text) convert text to lower case
611
+ text lpad(text,int,text) left pad string to specified length
612
+ text ltrim(text,text) left trim characters from text
613
+ text position(text,text) extract specified substring
614
+ text rpad(text,int,text) right pad string to specified length
615
+ text rtrim(text,text) right trim characters from text
616
+ text substr(text,int[,int]) extract specified substring
617
+ text upper(text) convert text to upper case
618
+
549
619
abstime
550
620
bool isfinite(abstime) TRUE if this is a finite time
551
621
datetime datetime(abstime) convert to datetime
@@ -587,6 +657,22 @@ circle
587
657
float8 radius(circle) radius of circle
588
658
float8 diameter(circle) diameter of circle
589
659
float8 area(circle) area of circle
660
+
661
+ .fi
662
+ .PP
663
+ SQL/92 defines functions with specific syntax. Some of these
664
+ are implemented using other Postgres functions.
665
+
666
+ .nf
667
+ SQL/92 Functions:
668
+
669
+ text
670
+ text position(text in text) extract specified substring
671
+ text substring(text [from int] [for int])
672
+ extract specified substring
673
+ text trim([leading|trailing|both] [text] from text)
674
+ trim characters from text
675
+
590
676
.fi
591
677
592
678
.SH "BINARY OPERATORS"
@@ -819,8 +905,8 @@ bool |lseg |line |?# |inter_sl
819
905
bool |lseg |line |@ |on_sl
820
906
bool |lseg |lseg |= |lseg_eq
821
907
bool |lseg |lseg |?# |lseg_intersect
822
- bool |lseg |lseg |?-\| |lseg_perp
823
- bool |lseg |lseg |?\|\| |lseg_parallel
908
+ bool |lseg |lseg |?-| |lseg_perp
909
+ bool |lseg |lseg |?|| |lseg_parallel
824
910
bool |money |money |< |cash_lt
825
911
bool |money |money |<= |cash_le
826
912
bool |money |money |<> |cash_ne
@@ -876,14 +962,14 @@ bool |point |box |@ |on_pb
876
962
bool |point |circle |@ |pt_contained_circle
877
963
bool |point |line |@ |on_pl
878
964
bool |point |lseg |@ |on_ps
879
- bool |point |path |@ |pt_contained_path
880
965
bool |point |path |@ |on_ppath
966
+ bool |point |path |@ |pt_contained_path
881
967
bool |point |point |<< |point_left
882
968
bool |point |point |<^ |point_below
883
969
bool |point |point |>> |point_right
884
970
bool |point |point |>^ |point_above
885
971
bool |point |point |?- |point_horiz
886
- bool |point |point |?\| |point_vert
972
+ bool |point |point |?| |point_vert
887
973
bool |point |point |~= |point_eq
888
974
bool |point |polygon |@ |pt_contained_poly
889
975
bool |polygon |point |~ |poly_contain_pt
@@ -939,8 +1025,14 @@ bool |tinterval |reltime |#> |intervallengt
939
1025
bool |tinterval |reltime |#>= |intervallenge
940
1026
bool |tinterval |tinterval |&& |intervalov
941
1027
bool |tinterval |tinterval |< |intervalct
1028
+ bool |tinterval |tinterval |< |intervallt
942
1029
bool |tinterval |tinterval |<< |intervalct
1030
+ bool |tinterval |tinterval |<= |intervalle
1031
+ bool |tinterval |tinterval |<> |intervalne
943
1032
bool |tinterval |tinterval |= |intervaleq
1033
+ bool |tinterval |tinterval |> |intervalgt
1034
+ bool |tinterval |tinterval |>= |intervalge
1035
+ bool |tinterval |tinterval |~= |intervalsame
944
1036
bool |varchar |text |!~ |textregexne
945
1037
bool |varchar |text |!~* |texticregexne
946
1038
bool |varchar |text |!~~ |textnlike
@@ -996,8 +1088,8 @@ float8 |lseg |box |<-> |dist_sb
996
1088
float8 |lseg |line |<-> |dist_sl
997
1089
float8 |lseg |lseg |<-> |lseg_distance
998
1090
float8 |path |path |<-> |path_distance
999
- float8 |point |box |<-> |dist_pl
1000
1091
float8 |point |box |<-> |dist_pb
1092
+ float8 |point |box |<-> |dist_pl
1001
1093
float8 |point |lseg |<-> |dist_ps
1002
1094
float8 |point |path |<-> |dist_ppath
1003
1095
float8 |point |point |<-> |point_distance
@@ -1035,8 +1127,18 @@ int4 |int4 |int4 |* |int4mul
1035
1127
int4 |int4 |int4 |+ |int4pl
1036
1128
int4 |int4 |int4 |- |int4mi
1037
1129
int4 |int4 |int4 |/ |int4div
1038
- money |money |float8 |* |cash_mul
1039
- money |money |float8 |/ |cash_div
1130
+ money |float4 |money |* |flt4_mul_cash
1131
+ money |float8 |money |* |flt8_mul_cash
1132
+ money |int2 |money |* |int2_mul_cash
1133
+ money |int4 |money |* |int4_mul_cash
1134
+ money |money |float4 |* |cash_mul_flt4
1135
+ money |money |float4 |/ |cash_div_flt4
1136
+ money |money |float8 |* |cash_mul_flt8
1137
+ money |money |float8 |/ |cash_div_flt8
1138
+ money |money |int2 |* |cash_mul_int2
1139
+ money |money |int2 |/ |cash_div_int2
1140
+ money |money |int4 |* |cash_mul_int4
1141
+ money |money |int4 |/ |cash_div_int4
1040
1142
money |money |money |+ |cash_pl
1041
1143
money |money |money |- |cash_mi
1042
1144
path |path |path |+ |path_add
@@ -1064,7 +1166,7 @@ timespan |timespan |timespan |+ |timespan_pl
1064
1166
timespan |timespan |timespan |- |timespan_mi
1065
1167
timespan |timespan |timespan |/ |timespan_div
1066
1168
tinterval|abstime |abstime |<#> |mktinterval
1067
- (446 rows)
1169
+ (462 rows)
1068
1170
1069
1171
.ec
1070
1172
.fi
@@ -1089,28 +1191,28 @@ left_unary|operand |return_type
1089
1191
----------+---------+-----------
1090
1192
@@ |box |point
1091
1193
@@ |circle |point
1092
- @ |float4 |float4
1093
1194
- |float4 |float4
1094
- \| / |float8 |float8
1195
+ @ |float4 |float4
1196
+ - |float8 |float8
1095
1197
@ |float8 |float8
1096
- ; |float8 |float8
1097
- : |float8 |float8
1198
+ |/ |float8 |float8
1199
+ ||/ |float8 |float8
1098
1200
% |float8 |float8
1099
- \|\| / |float8 |float8
1100
- - |float8 |float8
1201
+ : |float8 |float8
1202
+ ; |float8 |float8
1101
1203
- |int2 |int2
1102
- - |int4 |int4
1103
1204
!! |int4 |int4
1104
- ?- |lseg |bool
1105
- ?\| |lseg |bool
1205
+ - |int4 |int4
1106
1206
@@ |lseg |point
1107
- ?? |path |float8
1207
+ ?- |lseg |bool
1208
+ ?| |lseg |bool
1108
1209
# |path |int4
1210
+ ?? |path |float8
1109
1211
@@ |path |point
1110
1212
@@ |polygon |point
1111
1213
# |polygon |int4
1112
1214
- |timespan |timespan
1113
- \| |tinterval|abstime
1215
+ | |tinterval|abstime
1114
1216
(24 rows)
1115
1217
1116
1218
.ec
@@ -1150,7 +1252,8 @@ This list was generated from the Postgres system catalogs with the query:
1150
1252
1151
1253
.nf
1152
1254
.eo
1153
- SELECT a.aggname, t.typname
1255
+ SELECT a.aggname AS aggname,
1256
+ t.typname AS typname
1154
1257
FROM pg_aggregate a, pg_type t
1155
1258
WHERE a.aggbasetype = t.oid
1156
1259
ORDER BY aggname, typname;
0 commit comments