1
1
<!--
2
- $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.61 2001/09/04 03: 17:54 momjian Exp $
2
+ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.62 2001/09/09 17:21:51 petere Exp $
3
3
-->
4
4
5
5
<chapter id="datatype">
@@ -361,59 +361,59 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.61 2001/09/04 03:17:54 mo
361
361
362
362
<tbody>
363
363
<row>
364
- <entry>smallint</entry>
364
+ <entry><type> smallint</> </entry>
365
365
<entry>2 bytes</entry>
366
366
<entry>Fixed-precision</entry>
367
367
<entry>-32768 to +32767</entry>
368
368
</row>
369
369
<row>
370
- <entry>integer</entry>
370
+ <entry><type> integer</> </entry>
371
371
<entry>4 bytes</entry>
372
372
<entry>Usual choice for fixed-precision</entry>
373
373
<entry>-2147483648 to +2147483647</entry>
374
374
</row>
375
375
<row>
376
- <entry>bigint</entry>
376
+ <entry><type> bigint</> </entry>
377
377
<entry>8 bytes</entry>
378
378
<entry>Very large range fixed-precision</entry>
379
379
<entry>about 18 decimal digits</entry>
380
380
</row>
381
381
382
382
<row>
383
- <entry>decimal</entry>
383
+ <entry><type> decimal</> </entry>
384
384
<entry>variable</entry>
385
385
<entry>user-specified precision, exact</entry>
386
386
<entry>no limit</entry>
387
387
</row>
388
388
<row>
389
- <entry>numeric</entry>
389
+ <entry><type> numeric</> </entry>
390
390
<entry>variable</entry>
391
391
<entry>user-specified precision, exact</entry>
392
392
<entry>no limit</entry>
393
393
</row>
394
394
395
395
<row>
396
- <entry>real</entry>
396
+ <entry><type> real</> </entry>
397
397
<entry>4 bytes</entry>
398
398
<entry>variable-precision, inexact</entry>
399
399
<entry>6 decimal digits precision</entry>
400
400
</row>
401
401
<row>
402
- <entry>double precision</entry>
402
+ <entry><type> double precision</> </entry>
403
403
<entry>8 bytes</entry>
404
404
<entry>variable-precision, inexact</entry>
405
405
<entry>15 decimal digits precision</entry>
406
406
</row>
407
407
408
408
<row>
409
- <entry>serial</entry>
409
+ <entry><type> serial</> </entry>
410
410
<entry>4 bytes</entry>
411
411
<entry>autoincrementing integer</entry>
412
412
<entry>1 to 2147483647</entry>
413
413
</row>
414
414
415
415
<row>
416
- <entry>bigserial</entry>
416
+ <entry><type> bigserial</type> </entry>
417
417
<entry>8 bytes</entry>
418
418
<entry>autoincrementing integer</entry>
419
419
<entry>1 to 9223372036854775807</entry>
@@ -557,7 +557,7 @@ NUMERIC
557
557
<para>
558
558
The data types <type>real</type> and <type>double
559
559
precision</type> are inexact, variable precision numeric types.
560
- In practice, these types are usually implementations of IEEE 754
560
+ In practice, these types are usually implementations of <acronym> IEEE</acronym> 754
561
561
binary floating point (single and double precision,
562
562
respectively), to the extent that the underlying processor,
563
563
operating system, and compiler support it.
@@ -636,7 +636,7 @@ NUMERIC
636
636
</indexterm>
637
637
638
638
<para>
639
- The <type>serial</type> datatypes are not truly types, but are a
639
+ The <type>serial</type> data types are not truly types, but are a
640
640
notational convenience for setting up unique identifier columns
641
641
in tables.
642
642
In the current implementation, specifying
@@ -777,21 +777,17 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceabl
777
777
</thead>
778
778
<tbody>
779
779
<row>
780
- <entry>character(<replaceable>n</>), char(<replaceable>n</>)</entry>
780
+ <entry><type> character(<replaceable>n</>)</type>, <type> char(<replaceable>n</>)</type> </entry>
781
781
<entry>Fixed-length blank padded</entry>
782
782
</row>
783
783
<row>
784
- <entry>character varying(<replaceable>n</>), varchar(<replaceable>n</>)</entry>
784
+ <entry><type> character varying(<replaceable>n</>)</type>, <type> varchar(<replaceable>n</>)</type> </entry>
785
785
<entry>Variable-length with limit</entry>
786
786
</row>
787
787
<row>
788
- <entry>text</entry>
788
+ <entry><type> text</type> </entry>
789
789
<entry>Variable unlimited length</entry>
790
790
</row>
791
- <row>
792
- <entry>bytea</entry>
793
- <entry>binary data</entry>
794
- </row>
795
791
</tbody>
796
792
</tgroup>
797
793
</table>
@@ -839,19 +835,6 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceabl
839
835
standard, many other RDBMS packages have it as well.
840
836
</para>
841
837
842
- <para>
843
- The <type>bytea</type> data type allows storage of binary data,
844
- specifically allowing storage of NULLs which are entered as
845
- <literal>'\\000'</>. The first backslash is interpreted by the
846
- single quotes, and the second is recognized by <type>bytea</> and
847
- preceeds a three digit octal value. For a similar reason, a
848
- backslash must be entered into a field as <literal>'\\\\'</> or
849
- <literal>'\\134'</>. You may also have to escape line feeds and
850
- carriage return if your interface automatically translates these. It
851
- can store values of any length. <type>Bytea</> is a non-standard
852
- data type.
853
- </para>
854
-
855
838
<para>
856
839
The storage requirement for data of these types is 4 bytes plus
857
840
the actual string, and in case of <type>character</type> plus the
@@ -860,7 +843,7 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceabl
860
843
that can be stored is about 1 GB. (The maximum value that will be
861
844
allowed for <replaceable>n</> in the data type declaration is
862
845
actually larger than that. It wouldn't be very useful to change
863
- this because with multi-byte character encodings the number of
846
+ this because with multibyte character encodings the number of
864
847
characters and bytes can be quite different anyway.)
865
848
</para>
866
849
@@ -957,6 +940,23 @@ SELECT b, char_length(b) FROM test2;
957
940
958
941
</sect1>
959
942
943
+ <sect1 id="datatype-binary">
944
+ <title>Binary Data</title>
945
+
946
+ <para>
947
+ The <type>bytea</type> data type allows storage of binary data,
948
+ specifically allowing storage of NULLs which are entered as
949
+ <literal>'\\000'</>. The first backslash is interpreted by the
950
+ single quotes, and the second is recognized by <type>bytea</> and
951
+ precedes a three digit octal value. For a similar reason, a
952
+ backslash must be entered into a field as <literal>'\\\\'</> or
953
+ <literal>'\\134'</>. You may also have to escape line feeds and
954
+ carriage return if your interface automatically translates these. It
955
+ can store values of any length. <type>Bytea</> is a non-standard
956
+ data type.
957
+ </para>
958
+ </sect1>
959
+
960
960
<sect1 id="datatype-datetime">
961
961
<title>Date/Time Types</title>
962
962
@@ -1083,7 +1083,7 @@ SELECT b, char_length(b) FROM test2;
1083
1083
</para>
1084
1084
1085
1085
<sect3>
1086
- <title>date</title>
1086
+ <title><type> date</type> </title>
1087
1087
1088
1088
<indexterm>
1089
1089
<primary>date</primary>
@@ -1260,7 +1260,7 @@ SELECT b, char_length(b) FROM test2;
1260
1260
</sect3>
1261
1261
1262
1262
<sect3>
1263
- <title>time [ without time zone ]</title>
1263
+ <title><type> time [ without time zone ]</type> </title>
1264
1264
1265
1265
<indexterm>
1266
1266
<primary>time</primary>
@@ -1328,7 +1328,7 @@ SELECT b, char_length(b) FROM test2;
1328
1328
</sect3>
1329
1329
1330
1330
<sect3>
1331
- <title>time with time zone</title>
1331
+ <title><type> time with time zone</type> </title>
1332
1332
1333
1333
<para>
1334
1334
This type is defined by SQL92, but the definition exhibits
@@ -1382,7 +1382,7 @@ SELECT b, char_length(b) FROM test2;
1382
1382
</sect3>
1383
1383
1384
1384
<sect3>
1385
- <title>timestamp</title>
1385
+ <title><type> timestamp</type> </title>
1386
1386
1387
1387
<indexterm>
1388
1388
<primary>timestamp</primary>
@@ -1442,7 +1442,7 @@ January 8 04:05:06 1999 PST
1442
1442
</sect3>
1443
1443
1444
1444
<sect3>
1445
- <title>interval</title>
1445
+ <title><type> interval</type> </title>
1446
1446
1447
1447
<indexterm>
1448
1448
<primary>interval</primary>
@@ -1664,7 +1664,7 @@ January 8 04:05:06 1999 PST
1664
1664
</listitem>
1665
1665
<listitem>
1666
1666
<para>
1667
- The <envar>PGDATESTYLE</envar> environment variable used by the frontend libpq
1667
+ The <envar>PGDATESTYLE</envar> environment variable used by the frontend <application> libpq</application>
1668
1668
on session start-up.
1669
1669
</para>
1670
1670
</listitem>
@@ -1753,13 +1753,13 @@ January 8 04:05:06 1999 PST
1753
1753
<itemizedlist spacing="compact" mark="bullet">
1754
1754
<listitem>
1755
1755
<para>
1756
- The TZ environment variable is used by the backend directly
1756
+ The <envar>TZ</envar> environment variable is used by the backend directly
1757
1757
on postmaster start-up as the default time zone.
1758
1758
</para>
1759
1759
</listitem>
1760
1760
<listitem>
1761
1761
<para>
1762
- The PGTZ environment variable, if set at the client, is used by libpq
1762
+ The <envar> PGTZ</envar> environment variable, if set at the client, is used by libpq
1763
1763
to send a <command>SET TIME ZONE</command> command to the backend upon
1764
1764
connection.
1765
1765
</para>
@@ -1796,7 +1796,7 @@ January 8 04:05:06 1999 PST
1796
1796
<para>
1797
1797
If the runtime option <literal>AUSTRALIAN_TIMEZONES</literal> is set
1798
1798
then <literal>CST</literal> and <literal>EST</literal> refer to
1799
- Australian timezones , not American ones.
1799
+ Australian time zones , not American ones.
1800
1800
</para>
1801
1801
</note>
1802
1802
</para>
@@ -1939,49 +1939,49 @@ SELECT * FROM test1 WHERE a;
1939
1939
</thead>
1940
1940
<tbody>
1941
1941
<row>
1942
- <entry>point</entry>
1942
+ <entry><type> point</type> </entry>
1943
1943
<entry>16 bytes</entry>
1944
1944
<entry>(x,y)</entry>
1945
1945
<entry>Point in space</entry>
1946
1946
</row>
1947
1947
<row>
1948
- <entry>line</entry>
1948
+ <entry><type> line</type> </entry>
1949
1949
<entry>32 bytes</entry>
1950
1950
<entry>((x1,y1),(x2,y2))</entry>
1951
1951
<entry>Infinite line</entry>
1952
1952
</row>
1953
1953
<row>
1954
- <entry>lseg</entry>
1954
+ <entry><type> lseg</type> </entry>
1955
1955
<entry>32 bytes</entry>
1956
1956
<entry>((x1,y1),(x2,y2))</entry>
1957
1957
<entry>Finite line segment</entry>
1958
1958
</row>
1959
1959
<row>
1960
- <entry>box</entry>
1960
+ <entry><type> box</type> </entry>
1961
1961
<entry>32 bytes</entry>
1962
1962
<entry>((x1,y1),(x2,y2))</entry>
1963
1963
<entry>Rectangular box</entry>
1964
1964
</row>
1965
1965
<row>
1966
- <entry>path</entry>
1966
+ <entry><type> path</type> </entry>
1967
1967
<entry>4+32n bytes</entry>
1968
1968
<entry>((x1,y1),...)</entry>
1969
1969
<entry>Closed path (similar to polygon)</entry>
1970
1970
</row>
1971
1971
<row>
1972
- <entry>path</entry>
1972
+ <entry><type> path</type> </entry>
1973
1973
<entry>4+32n bytes</entry>
1974
1974
<entry>[(x1,y1),...]</entry>
1975
1975
<entry>Open path</entry>
1976
1976
</row>
1977
1977
<row>
1978
- <entry>polygon</entry>
1978
+ <entry><type> polygon</type> </entry>
1979
1979
<entry>4+32n bytes</entry>
1980
1980
<entry>((x1,y1),...)</entry>
1981
1981
<entry>Polygon (similar to closed path)</entry>
1982
1982
</row>
1983
1983
<row>
1984
- <entry>circle</entry>
1984
+ <entry><type> circle</type> </entry>
1985
1985
<entry>24 bytes</entry>
1986
1986
<entry><(x,y),r></entry>
1987
1987
<entry>Circle (center and radius)</entry>
@@ -2296,21 +2296,21 @@ SELECT * FROM test1 WHERE a;
2296
2296
<tbody>
2297
2297
2298
2298
<row>
2299
- <entry>cidr</entry>
2299
+ <entry><type> cidr</type> </entry>
2300
2300
<entry>12 bytes</entry>
2301
2301
<entry>IP networks</entry>
2302
2302
<entry>valid IPv4 networks</entry>
2303
2303
</row>
2304
2304
2305
2305
<row>
2306
- <entry>inet</entry>
2306
+ <entry><type> inet</type> </entry>
2307
2307
<entry>12 bytes</entry>
2308
2308
<entry>IP hosts and networks</entry>
2309
2309
<entry>valid IPv4 hosts or networks</entry>
2310
2310
</row>
2311
2311
2312
2312
<row>
2313
- <entry>macaddr</entry>
2313
+ <entry><type> macaddr</type> </entry>
2314
2314
<entry>6 bytes</entry>
2315
2315
<entry>MAC addresses</entry>
2316
2316
<entry>customary formats</entry>
@@ -2386,9 +2386,9 @@ SELECT * FROM test1 WHERE a;
2386
2386
<tgroup cols="3">
2387
2387
<thead>
2388
2388
<row>
2389
- <entry>CIDR Input</entry>
2390
- <entry>CIDR Displayed</entry>
2391
- <entry>abbrev( CIDR)</entry>
2389
+ <entry><type> CIDR</type> Input</entry>
2390
+ <entry><type> CIDR</type> Displayed</entry>
2391
+ <entry><function> abbrev</function>(<type> CIDR</type> )</entry>
2392
2392
</row>
2393
2393
</thead>
2394
2394
<tbody>
0 commit comments