Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 384d4f6

Browse files
author
Thomas G. Lockhart
committed
Update catalog lists for v6.2.
Add documentation of some text functions. Add descriptions of some new SQL/92-compatible string functions.
1 parent c19bd8c commit 384d4f6

File tree

1 file changed

+132
-29
lines changed

1 file changed

+132
-29
lines changed

src/man/pgbuiltin.3

+132-29
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.\" This is -*-nroff-*-
22
.\" 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 $
44
.TH PGBUILTIN INTRO 04/01/97 PostgreSQL PostgreSQL
55
.SH "DESCRIPTION"
66
This section describes the data types, functions and operators
@@ -37,12 +37,9 @@ described in this section.
3737
date ANSI SQL date type
3838
datetime general-use date and time
3939
filename large object filename
40-
int alias for int4
41-
integer alias for int4
4240
int2 two-byte signed integer
4341
int28 array of 8 int2
4442
int4 four-byte signed integer
45-
float alias for float4
4643
float4 single-precision floating-point number
4744
float8 double-precision floating-point number
4845
lseg 2-dimensional line segment
@@ -57,11 +54,9 @@ described in this section.
5754
point 2-dimensional geometric point
5855
polygon 2-dimensional polygon (same as a closed path)
5956
circle 2-dimensional circle (center and radius)
60-
real alias for float4
6157
regproc registered procedure
6258
reltime (relative) date and time span (duration)
6359
smgr storage manager
64-
smallint alias for int2
6560
text variable length array of characters
6661
tid tuple identifier type
6762
time ANSI SQL time type
@@ -71,6 +66,52 @@ described in this section.
7166
varchar variable-length characters
7267
xid transaction identifier type
7368

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+
\fBPOSTGRES Type\fP \fBSQL/92 Type\fP \fBMeaning\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+
\fBSQL/92 Function\fP \fBMeaning\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+
74115
.fi
75116
.in
76117
.PP
@@ -83,8 +124,11 @@ Most date and time types share code for data input. For those types (
83124
.IR datetime ,
84125
.IR abstime ,
85126
.IR timestamp ,
86-
.IR timespan and
87-
.IR reltime )
127+
.IR timespan ,
128+
.IR reltime ,
129+
.IR date ,
130+
and
131+
.IR time )
88132
the input can have any of a wide variety of styles. For numeric date representations,
89133
European and US conventions can differ, and the proper interpretation is obtained
90134
by using the
@@ -97,6 +141,11 @@ Postgres (see section on
97141
with the SQL style having European and US variants (see
98142
.IR set (l)).
99143

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+
100149
.SH "DATETIME"
101150
General-use date and time is input using a wide range of
102151
styles, including ISO-compatible, SQL-compatible, traditional
@@ -531,7 +580,11 @@ tinterval
531580

532581
.SH "FUNCTIONS"
533582
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().
535588
.PP
536589
For the
537590
date_part() and date_trunc()
@@ -546,6 +599,23 @@ to return day of week and `epoch' to return seconds since 1970.
546599
.nf
547600
Functions:
548601

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+
549619
abstime
550620
bool isfinite(abstime) TRUE if this is a finite time
551621
datetime datetime(abstime) convert to datetime
@@ -587,6 +657,22 @@ circle
587657
float8 radius(circle) radius of circle
588658
float8 diameter(circle) diameter of circle
589659
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+
590676
.fi
591677

592678
.SH "BINARY OPERATORS"
@@ -819,8 +905,8 @@ bool |lseg |line |?# |inter_sl
819905
bool |lseg |line |@ |on_sl
820906
bool |lseg |lseg |= |lseg_eq
821907
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
824910
bool |money |money |< |cash_lt
825911
bool |money |money |<= |cash_le
826912
bool |money |money |<> |cash_ne
@@ -876,14 +962,14 @@ bool |point |box |@ |on_pb
876962
bool |point |circle |@ |pt_contained_circle
877963
bool |point |line |@ |on_pl
878964
bool |point |lseg |@ |on_ps
879-
bool |point |path |@ |pt_contained_path
880965
bool |point |path |@ |on_ppath
966+
bool |point |path |@ |pt_contained_path
881967
bool |point |point |<< |point_left
882968
bool |point |point |<^ |point_below
883969
bool |point |point |>> |point_right
884970
bool |point |point |>^ |point_above
885971
bool |point |point |?- |point_horiz
886-
bool |point |point |?\| |point_vert
972+
bool |point |point |?| |point_vert
887973
bool |point |point |~= |point_eq
888974
bool |point |polygon |@ |pt_contained_poly
889975
bool |polygon |point |~ |poly_contain_pt
@@ -939,8 +1025,14 @@ bool |tinterval |reltime |#> |intervallengt
9391025
bool |tinterval |reltime |#>= |intervallenge
9401026
bool |tinterval |tinterval |&& |intervalov
9411027
bool |tinterval |tinterval |< |intervalct
1028+
bool |tinterval |tinterval |< |intervallt
9421029
bool |tinterval |tinterval |<< |intervalct
1030+
bool |tinterval |tinterval |<= |intervalle
1031+
bool |tinterval |tinterval |<> |intervalne
9431032
bool |tinterval |tinterval |= |intervaleq
1033+
bool |tinterval |tinterval |> |intervalgt
1034+
bool |tinterval |tinterval |>= |intervalge
1035+
bool |tinterval |tinterval |~= |intervalsame
9441036
bool |varchar |text |!~ |textregexne
9451037
bool |varchar |text |!~* |texticregexne
9461038
bool |varchar |text |!~~ |textnlike
@@ -996,8 +1088,8 @@ float8 |lseg |box |<-> |dist_sb
9961088
float8 |lseg |line |<-> |dist_sl
9971089
float8 |lseg |lseg |<-> |lseg_distance
9981090
float8 |path |path |<-> |path_distance
999-
float8 |point |box |<-> |dist_pl
10001091
float8 |point |box |<-> |dist_pb
1092+
float8 |point |box |<-> |dist_pl
10011093
float8 |point |lseg |<-> |dist_ps
10021094
float8 |point |path |<-> |dist_ppath
10031095
float8 |point |point |<-> |point_distance
@@ -1035,8 +1127,18 @@ int4 |int4 |int4 |* |int4mul
10351127
int4 |int4 |int4 |+ |int4pl
10361128
int4 |int4 |int4 |- |int4mi
10371129
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
10401142
money |money |money |+ |cash_pl
10411143
money |money |money |- |cash_mi
10421144
path |path |path |+ |path_add
@@ -1064,7 +1166,7 @@ timespan |timespan |timespan |+ |timespan_pl
10641166
timespan |timespan |timespan |- |timespan_mi
10651167
timespan |timespan |timespan |/ |timespan_div
10661168
tinterval|abstime |abstime |<#> |mktinterval
1067-
(446 rows)
1169+
(462 rows)
10681170

10691171
.ec
10701172
.fi
@@ -1089,28 +1191,28 @@ left_unary|operand |return_type
10891191
----------+---------+-----------
10901192
@@ |box |point
10911193
@@ |circle |point
1092-
@ |float4 |float4
10931194
- |float4 |float4
1094-
\|/ |float8 |float8
1195+
@ |float4 |float4
1196+
- |float8 |float8
10951197
@ |float8 |float8
1096-
; |float8 |float8
1097-
: |float8 |float8
1198+
|/ |float8 |float8
1199+
||/ |float8 |float8
10981200
% |float8 |float8
1099-
\|\|/ |float8 |float8
1100-
- |float8 |float8
1201+
: |float8 |float8
1202+
; |float8 |float8
11011203
- |int2 |int2
1102-
- |int4 |int4
11031204
!! |int4 |int4
1104-
?- |lseg |bool
1105-
?\| |lseg |bool
1205+
- |int4 |int4
11061206
@@ |lseg |point
1107-
?? |path |float8
1207+
?- |lseg |bool
1208+
?| |lseg |bool
11081209
# |path |int4
1210+
?? |path |float8
11091211
@@ |path |point
11101212
@@ |polygon |point
11111213
# |polygon |int4
11121214
- |timespan |timespan
1113-
\| |tinterval|abstime
1215+
| |tinterval|abstime
11141216
(24 rows)
11151217

11161218
.ec
@@ -1150,7 +1252,8 @@ This list was generated from the Postgres system catalogs with the query:
11501252

11511253
.nf
11521254
.eo
1153-
SELECT a.aggname, t.typname
1255+
SELECT a.aggname AS aggname,
1256+
t.typname AS typname
11541257
FROM pg_aggregate a, pg_type t
11551258
WHERE a.aggbasetype = t.oid
11561259
ORDER BY aggname, typname;

0 commit comments

Comments
 (0)