1 <chapter id="datatype">
2 <title>Data Types</title>
6 Describes the built-in data types available in
7 <productname>Postgres</productname>.
12 <productname>Postgres</productname> has a rich set of native data
13 types available to users.
14 Users may add new types to <productname>Postgres</productname> using the
15 <command>DEFINE TYPE</command>
16 command described elsewhere.
20 In the context of data types, the following sections will discuss
21 <acronym>SQL</acronym> standards compliance, porting issues, and usage.
23 Some <productname>Postgres</productname> types correspond directly to
24 <acronym>SQL92</acronym>-compatible types. In other
25 cases, data types defined by <acronym>SQL92</acronym> syntax are mapped directly
26 into native <productname>Postgres</productname> types.
28 Many of the built-in types have obvious external formats. However, several
29 types are either unique to <productname>Postgres</productname>,
30 such as open and closed paths, or have
31 several possibilities for formats, such as the date and time types.
36 <title><productname>Postgres</productname> Data Types</title>
37 <titleabbrev>Data Types</titleabbrev>
41 <entry><productname>Postgres</productname> Type</entry>
42 <entry><acronym>SQL92</acronym> or <acronym>SQL3</acronym> Type</entry>
43 <entry>Description</entry>
49 <entry>boolean</entry>
50 <entry>logical boolean (true/false)</entry>
55 <entry>rectangular box in 2D plane</entry>
58 <entry>char(n)</entry>
59 <entry>character(n)</entry>
60 <entry>fixed-length character string</entry>
65 <entry>IP version 4 network or host address</entry>
70 <entry>circle in 2D plane</entry>
75 <entry>calendar date without time of day</entry>
78 <entry>float4/8</entry>
79 <entry>float(p)</entry>
80 <entry>floating-point number with precision p</entry>
84 <entry>real, double precision</entry>
85 <entry>double-precision floating-point number</entry>
90 <entry>IP version 4 network or host address</entry>
94 <entry>smallint</entry>
95 <entry>signed two-byte integer</entry>
99 <entry>int, integer</entry>
100 <entry>signed 4-byte integer</entry>
104 <entry>decimal(p,s)</entry>
105 <entry>exact numeric for p <= 9, s = 0</entry>
109 <entry>numeric(p,s)</entry>
110 <entry>exact numeric for p == 9, s = 0</entry>
115 <entry>signed 8-byte integer</entry>
120 <entry>infinite line in 2D plane</entry>
125 <entry>line segment in 2D plane</entry>
129 <entry>decimal(9,2)</entry>
130 <entry>US-style currency</entry>
135 <entry>open and closed geometric path in 2D plane</entry>
140 <entry>geometric point in 2D plane</entry>
143 <entry>polygon</entry>
145 <entry>closed geometric path in 2D plane</entry>
148 <entry>serial</entry>
150 <entry>unique id for indexing and cross-reference</entry>
155 <entry>time of day</entry>
158 <entry>timespan</entry>
159 <entry>interval</entry>
160 <entry>general-use time span</entry>
163 <entry>timestamp</entry>
164 <entry>timestamp with time zone</entry>
165 <entry>date/time</entry>
168 <entry>varchar(n)</entry>
169 <entry>character varying(n)</entry>
170 <entry>variable-length character string</entry>
180 The <type>cidr</type> and <type>inet</type> types are designed to handle any IP type
181 but only ipv4 is handled in the current implementation.
182 Everything here that talks about ipv4 will apply to ipv6 in a future release.</para>
187 <title><productname>Postgres</productname> Function Constants</title>
188 <titleabbrev>Constants</titleabbrev>
192 <entry><productname>Postgres</productname> Function</entry>
193 <entry><acronym>SQL92</acronym> Constant</entry>
194 <entry>Description</entry>
199 <entry>getpgusername()</entry>
200 <entry>current_user</entry>
201 <entry>user name in current session</entry>
204 <entry>date('now')</entry>
205 <entry>current_date</entry>
206 <entry>date of current transaction</entry>
209 <entry>time('now')</entry>
210 <entry>current_time</entry>
211 <entry>time of current transaction</entry>
214 <entry>timestamp('now')</entry>
215 <entry>current_timestamp</entry>
216 <entry>date and time of current transaction</entry>
224 <productname>Postgres</productname> has features at the forefront of
225 <acronym>ORDBMS</acronym> development. In addition to
226 <acronym>SQL3</acronym> conformance, substantial portions
227 of <acronym>SQL92</acronym> are also supported.
228 Although we strive for <acronym>SQL92</acronym> compliance,
229 there are some aspects of the standard
230 which are ill considered and which should not live through subsequent standards.
231 <productname>Postgres</productname> will not make great efforts to
232 conform to these features; however, these tend to apply in little-used
233 or obsure cases, and a typical user is not likely to run into them.</para>
236 Most of the input and output functions corresponding to the
237 base types (e.g., integers and floating point numbers) do some
239 Some of the operators and functions (e.g.,
240 addition and multiplication) do not perform run-time error-checking in the
241 interests of improving execution speed.
242 On some systems, for example, the numeric operators for some data types may
243 silently underflow or overflow.
247 Note that some of the input and output functions are not invertible. That is,
248 the result of an output function may lose precision when compared to
253 The original <productname>Postgres</productname> v4.2 code received from
254 Berkeley rounded all double precision floating point results to six digits for
255 output. Starting with v6.1, floating point numbers are allowed to retain
256 most of the intrinsic precision of the type (typically 15 digits for doubles,
257 6 digits for 4-byte floats).
258 Other types with underlying floating point fields (e.g. geometric
259 types) carry similar precision.</para>
264 <title>Numeric Types</title>
267 Numeric types consist of two- and four-byte integers and four- and eight-byte
268 floating point numbers.</para>
272 <title><productname>Postgres</productname> Numeric Types</title>
273 <titleabbrev>Numerics</titleabbrev>
277 <entry>Numeric Type</entry>
278 <entry>Storage</entry>
279 <entry>Description</entry>
285 <entry>float4</entry>
286 <entry>4 bytes</entry>
287 <entry>Variable-precision</entry>
288 <entry>6 decimal places</entry>
291 <entry>float8</entry>
292 <entry>8 bytes</entry>
293 <entry>Variable-precision</entry>
294 <entry>15 decimal places</entry>
298 <entry>2 bytes</entry>
299 <entry>Fixed-precision</entry>
300 <entry>-32768 to +32767</entry>
304 <entry>4 bytes</entry>
305 <entry>Usual choice for fixed-precision</entry>
306 <entry>-2147483648 to +2147483647</entry>
310 <entry>8 bytes</entry>
311 <entry>Very large range fixed-precision</entry>
312 <entry>+/- > 18 decimal places</entry>
315 <entry>serial</entry>
316 <entry>4 bytes</entry>
317 <entry>Identifer or cross-reference</entry>
318 <entry>0 to +2147483647</entry>
326 The numeric types have a full set of corresponding arithmetic operators and
327 functions. Refer to <xref endterm="math-opers" linkend="math-opers">
328 and <xref endterm="math-funcs" linkend="math-funcs"> for more information.
332 The <type>serial</type> type is a special-case type constructed by
333 <productname>Postgres</productname> from other existing components.
334 It is typically used to create unique identifiers for table entries.
335 In the current implementation, specifying
338 CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceable class="parameter">colname</replaceable> SERIAL);
341 is equivalent to specifying:
344 CREATE SEQUENCE <replaceable class="parameter">tablename</replaceable>_<replaceable class="parameter">colname</replaceable>_seq;
345 CREATE TABLE <replaceable class="parameter">tablename</replaceable>
346 (<replaceable class="parameter">colname</replaceable> INT4 DEFAULT nextval('<replaceable class="parameter">tablename</replaceable>_<replaceable class="parameter">colname</replaceable>_seq');
347 CREATE UNIQUE INDEX <replaceable class="parameter">tablename</replaceable>_<replaceable class="parameter">colname</replaceable>_key on <replaceable class="parameter">tablename</replaceable> (<replaceable class="parameter">colname</replaceable>);
352 The implicit sequence created for the <type>serial</type> type will
353 <emphasis>not</emphasis> be automatically removed when the table is dropped.
354 So, the following commands executed in order will likely fail:
357 CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceable class="parameter">colname</replaceable> SERIAL);
358 DROP TABLE <replaceable class="parameter">tablename</replaceable>;
359 CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceable class="parameter">colname</replaceable> SERIAL);
362 The sequence will remain in the database until explicitly dropped using
363 <command>DROP SEQUENCE</command>.</para>
368 The <firstterm>exact numerics</firstterm> <type>decimal</type> and
370 have fully implemented syntax but currently
371 (<productname>Postgres</productname> v6.4)
372 support only a small range of precision and/or range values.
373 The <type>int8</type> type may not be available on all platforms since
374 it relies on compiler support for this.
380 <title>Monetary Type</title>
383 The <type>money</type> type supports US-style currency with
384 fixed decimal point representation.
385 If <productname>Postgres</productname> is compiled with USE_LOCALE
386 then the money type should use the monetary conventions defined for
387 <citetitle>locale(7)</citetitle>.
392 <title><productname>Postgres</productname> Monetary Types</title>
393 <titleabbrev>Money</titleabbrev>
397 <entry>Monetary Type</entry>
398 <entry>Storage</entry>
399 <entry>Description</entry>
406 <entry>4 bytes</entry>
407 <entry>Fixed-precision</entry>
408 <entry>-21474836.48 to +21474836.47</entry>
417 should eventually replace the money type. It has a
418 fully implemented syntax but currently
419 (<productname>Postgres</productname> v6.4)
420 support only a small range of precision and/or range values
421 and cannot adequately substitute for the money type.
427 <title>Character Types</title>
430 <acronym>SQL92</acronym> defines two primary character types:
431 <type>char</type> and <type>varchar</type>.
432 <productname>Postgres</productname> supports these types, in
433 addition to the more general <type>text</type> type,
434 which unlike <type>varchar</type>
435 does not require an upper
436 limit to be declared on the size of the field.
441 <title><productname>Postgres</productname> Character Types</title>
442 <titleabbrev>Characters</titleabbrev>
446 <entry>Character Type</entry>
447 <entry>Storage</entry>
448 <entry>Recommendation</entry>
449 <entry>Description</entry>
455 <entry>1 byte</entry>
456 <entry><acronym>SQL92</acronym>-compatible</entry>
457 <entry>Single character</entry>
460 <entry>char(n)</entry>
461 <entry>(4+n) bytes</entry>
462 <entry><acronym>SQL92</acronym>-compatible</entry>
463 <entry>Fixed-length blank padded</entry>
467 <entry>(4+x) bytes</entry>
468 <entry>Best choice</entry>
469 <entry>Variable-length</entry>
472 <entry>varchar(n)</entry>
473 <entry>(4+n) bytes</entry>
474 <entry><acronym>SQL92</acronym>-compatible</entry>
475 <entry>Variable-length with limit</entry>
483 There is one other fixed-length character type.
484 The <type>name</type> type
485 only has one purpose and that is to provide
486 <productname>Postgres</productname> with a
487 special type to use for internal names.
488 It is not intended for use by the general user.
489 It's length is currently defined as 32 chars
490 but should be reference using NAMEDATALEN.
491 This is set at compile time and may change in a future release.
496 <title><productname>Postgres</productname> Specialty Character Type</title>
497 <titleabbrev>Specialty Characters</titleabbrev>
501 <entry>Character Type</entry>
502 <entry>Storage</entry>
503 <entry>Description</entry>
509 <entry>32 bytes</entry>
510 <entry>Thirty-two character internal type</entry>
520 <title>Date/Time Types</title>
523 There are two fundamental kinds of date and time measurements:
524 absolute clock times and relative time intervals.
525 Both kinds of quantities should have behaviors demonstrating both
526 continuity and smoothness.
527 <productname>Postgres</productname> supplies two primary user-oriented
529 <type>datetime</type> and <type>timespan</type>, as well as
530 the related <acronym>SQL92</acronym> types <type>timestamp</type>,
531 <type>interval</type>,
532 <type>date</type> and <type>time</type>.
536 In a future release, <type>datetime</type> and <type>timespan</type> are likely
537 to merge with the <acronym>SQL92</acronym> types <type>timestamp</type>,
538 <type>interval</type>.
539 Other date and time types are also available, mostly
540 for historical reasons.
545 <title><productname>Postgres</productname> Date/Time Types</title>
546 <titleabbrev>Date/Time</titleabbrev>
550 <entry>Date/Time Type</entry>
551 <entry>Storage</entry>
552 <entry>Recommendation</entry>
553 <entry>Description</entry>
558 <entry>abstime</entry>
559 <entry>4 bytes</entry>
560 <entry>original date and time</entry>
561 <entry>limited range</entry>
565 <entry>4 bytes</entry>
566 <entry><acronym>SQL92</acronym> type</entry>
567 <entry>wide range</entry>
570 <entry>datetime</entry>
571 <entry>8 bytes</entry>
572 <entry>best general date and time</entry>
573 <entry>wide range, high precision</entry>
576 <entry>interval</entry>
577 <entry>12 bytes</entry>
578 <entry><acronym>SQL92</acronym> type</entry>
579 <entry>equivalent to timespan</entry>
582 <entry>reltime</entry>
583 <entry>4 bytes</entry>
584 <entry>original time interval</entry>
585 <entry>limited range, low precision</entry>
589 <entry>4 bytes</entry>
590 <entry><acronym>SQL92</acronym> type</entry>
591 <entry>wide range</entry>
594 <entry>timespan</entry>
595 <entry>12 bytes</entry>
596 <entry>best general time interval</entry>
597 <entry>wide range, high precision</entry>
600 <entry>timestamp</entry>
601 <entry>4 bytes</entry>
602 <entry><acronym>SQL92</acronym> type</entry>
603 <entry>limited range</entry>
609 <type>timestamp</type> is currently implemented separately from
610 <type>datetime</type>, although they share input and output routines.
615 <title><productname>Postgres</productname> Date/Time Ranges</title>
616 <titleabbrev>Ranges</titleabbrev>
620 <entry>Date/Time Type</entry>
621 <entry>Earliest</entry>
622 <entry>Latest</entry>
623 <entry>Resolution</entry>
628 <entry>abstime</entry>
629 <entry>1901-12-14</entry>
630 <entry>2038-01-19</entry>
635 <entry>4713 BC</entry>
636 <entry>32767 AD</entry>
640 <entry>datetime</entry>
641 <entry>4713 BC</entry>
642 <entry>1465001 AD</entry>
643 <entry>1 microsec to 14 digits</entry>
646 <entry>interval</entry>
647 <entry>-178000000 years</entry>
648 <entry>178000000 years</entry>
649 <entry>1 microsec</entry>
652 <entry>reltime</entry>
653 <entry>-68 years</entry>
654 <entry>+68 years</entry>
659 <entry>00:00:00.00</entry>
660 <entry>23:59:59.99</entry>
661 <entry>1 microsec</entry>
664 <entry>timespan</entry>
665 <entry>-178000000 years</entry>
666 <entry>178000000 years</entry>
667 <entry>1 microsec (14 digits)</entry>
670 <entry>timestamp</entry>
671 <entry>1901-12-14</entry>
672 <entry>2038-01-19</entry>
681 <productname>Postgres</productname> endeavors to be compatible with
682 <acronym>SQL92</acronym> definitions for typical usage.
683 The <acronym>SQL92</acronym> standard has an odd mix of date and
684 time types and capabilities. Two obvious problems are:
689 Although the <type>date</type> type
690 does not have an associated time zone, the
691 <type>time</type> type can or does.</para></listitem>
695 The default time zone is specified as a constant integer offset
696 from GMT/UTC.</para></listitem>
700 However, time zones in the real world can have no meaning unless
701 associated with a date as well as a time
702 since the offset may vary through the year with daylight savings
707 To address these difficulties, <productname>Postgres</productname>
708 associates time zones only with date and time
709 types which contain both date and time,
710 and assumes local time for any type containing only
711 date or time. Further, time zone support is derived from
712 the underlying operating system
713 time zone capabilities, and hence can handle daylight savings time
714 and other expected behavior.
718 In future releases, the number of date/time types will decrease,
719 with the current implementation of
720 <type>datetime</type> becoming <type>timestamp</type>,
721 <type>timespan</type> becoming <type>interval</type>,
722 and (possibly) <type>abstime</type> and <type>reltime</type>
723 being deprecated in favor of <type>timestamp</type> and <type>interval</type>.
724 The more arcane features of the date/time definitions from
725 the <acronym>SQL92</acronym> standard are not likely to be pursued.
729 <title>Date/Time Styles</title>
732 Output formats can be set to one of four styles:
733 ISO-8601, <acronym>SQL</acronym> (Ingres), traditional
734 Postgres, and German.
737 <title><productname>Postgres</productname> Date Styles</title>
738 <titleabbrev>Styles</titleabbrev>
742 <entry>Style Specification</entry>
743 <entry>Description</entry>
744 <entry>Example</entry>
750 <entry>ISO-8601 standard</entry>
751 <entry>1997-12-17 07:37:16-08</entry>
754 <entry><acronym>SQL</acronym></entry>
755 <entry>Traditional style</entry>
756 <entry>12/17/1997 07:37:16.00 PST</entry>
759 <entry>Postgres</entry>
760 <entry>Original style</entry>
761 <entry>Wed Dec 17 07:37:16 1997 PST</entry>
764 <entry>German</entry>
765 <entry>Regional style</entry>
766 <entry>17.12.1997 07:37:16.00 PST</entry>
774 The <acronym>SQL</acronym> style has European and non-European (US) variants,
775 which determines whether month follows day or vica versa.
778 <title><productname>Postgres</productname> Date Order Conventions</title>
779 <titleabbrev>Order</titleabbrev>
783 <entry>Style Specification</entry>
784 <entry>Description</entry>
785 <entry>Example</entry>
790 <entry>European</entry>
791 <entry>Regional convention</entry>
792 <entry>17/12/1997 15:37:16.00 MET</entry>
795 <entry>NonEuropean</entry>
796 <entry>Regional convention</entry>
797 <entry>12/17/1997 07:37:16.00 PST</entry>
801 <entry>Regional convention</entry>
802 <entry>12/17/1997 07:37:16.00 PST</entry>
810 There are several ways to affect the appearance of date/time types:
812 <itemizedlist spacing="compact" mark="bullet">
815 The PGDATESTYLE environment variable used by the backend directly
816 on postmaster startup.
821 The PGDATESTYLE environment variable used by the frontend libpq
827 <command>SET DATESTYLE</command> <acronym>SQL</acronym> command.
834 For <productname>Postgres</productname> v6.4 (and earlier)
835 the default date/time style is
836 "non-European traditional Postgres".
837 In future releases, the default may become "ISO" (compatible with ISO-8601),
838 which alleviates date specification ambiguities and Y2K collation problems.
844 <title>Time Zones</title>
847 <productname>Postgres</productname> obtains time zone support
848 from the underlying operating system.
849 All dates and times are stored internally in Universal Coordinated Time (UTC),
850 alternately known as Greenwich Mean Time (GMT).
851 Times are converted to local time on the database server before being
852 sent to the client frontend, hence by default are in the server time zone.</para>
855 There are several ways to affect the time zone behavior:
857 <itemizedlist spacing="compact" mark="bullet">
860 The TZ environment variable used by the backend directly
861 on postmaster startup as the default time zone.
866 The PGTZ environment variable set at the client used by libpq
867 to send time zone information to the backend upon connection.
872 The <acronym>SQL</acronym> command <command>SET TIME ZONE</command>
873 sets the time zone for the session.
876 </itemizedlist></para>
879 If an invalid time zone is specified,
880 the time zone becomes GMT (on most systems anyway).
885 <title>Date/Time Input</title>
888 General-use date and time is input using a wide range of
889 styles, including ISO-compatible, <acronym>SQL</acronym>-compatible,
890 traditional <productname>Postgres</productname>
891 and other permutations of date and time. In cases where interpretation
892 can be ambiguous (quite possible with many traditional styles of date
893 specification) <productname>Postgres</productname> uses a style setting
894 to resolve the ambiguity.
898 Most date and time types share code for data input. For those types
899 the input can have any of a wide variety of styles. For numeric date
901 European and US conventions can differ, and the proper interpretation
902 is obtained by using the <command>SET DATESTYLE</command>
903 command before entering data.
904 Note that the style setting does not preclude use of various styles for input;
905 it is used primarily to determine the output style and to resolve ambiguities.
909 The special values <literal>current</literal>,
910 <literal>infinity</literal> and <literal>-infinity</literal> are provided.
911 <literal>infinity</literal> specifies a time later than any other valid time, and
912 <literal>-infinity</literal> specifies a time earlier than any other valid time.
913 <literal>current</literal> indicates that the current time should be
914 substituted whenever this value appears in a computation.
919 <literal>now</literal>,
920 <literal>today</literal>,
921 <literal>yesterday</literal>,
922 <literal>tomorrow</literal>,
923 and <literal>epoch</literal>
924 can be used to specify time values.
925 <literal>now</literal>
926 means the current transaction time, and differs from
927 <literal>current</literal>
928 in that the current time is immediately substituted for it.
929 <literal>epoch</literal> means <literal>Jan 1 00:00:00 1970 GMT</literal>.
934 <title><productname>Postgres</productname> Date/Time Special Constants</title>
935 <titleabbrev>Constants</titleabbrev>
939 <entry>Constant</entry>
940 <entry>Description</entry>
945 <entry>current</entry>
946 <entry>Current transaction time, deferred</entry>
950 <entry>1970-01-01 00:00:00+00 (Unix system time zero)</entry>
953 <entry>infinity</entry>
954 <entry>Later than other valid times</entry>
957 <entry>-infinity</entry>
958 <entry>Earlier than other valid times</entry>
961 <entry>invalid</entry>
962 <entry>Illegal entry</entry>
966 <entry>Current transaction time</entry>
970 <entry>Midnight today</entry>
973 <entry>tomorrow</entry>
974 <entry>Midnight tomorrow</entry>
977 <entry>yesterday</entry>
978 <entry>Midnight yesterday</entry>
987 <title><productname>Postgres</productname> Date Input</title>
988 <titleabbrev>Date Inputs</titleabbrev>
992 <entry>Example</entry>
993 <entry>Description</entry>
998 <entry>January 8, 1999</entry>
999 <entry>Unambiguous text month</entry>
1002 <entry>1999-01-08</entry>
1003 <entry>ISO-8601</entry>
1006 <entry>1/8/1999</entry>
1007 <entry>US; read as August 1 in European mode</entry>
1010 <entry>8/1/1999</entry>
1011 <entry>European; read as August 1 in US mode</entry>
1014 <entry>1/18/1999</entry>
1015 <entry>US; read as January 18 in any mode</entry>
1018 <entry>1999.008</entry>
1019 <entry>Year and day of year</entry>
1022 <entry>19990108</entry>
1023 <entry>ISO-8601 year, month, day</entry>
1026 <entry>990108</entry>
1027 <entry>ISO-8601 year, month, day</entry>
1030 <entry>1999.008</entry>
1031 <entry>Year and day of year</entry>
1034 <entry>99008</entry>
1035 <entry>Year and day of year</entry>
1038 <entry>January 8, 99 BC</entry>
1039 <entry>Year 99 before the Christian Era</entry>
1047 <table tocentry="1">
1048 <title><productname>Postgres</productname> Month Abbreviations</title>
1049 <titleabbrev>Month Abbreviations</titleabbrev>
1053 <entry>Month</entry>
1054 <entry>Abbreviations</entry>
1059 <entry>April</entry>
1063 <entry>August</entry>
1067 <entry>December</entry>
1071 <entry>February</entry>
1075 <entry>January</entry>
1087 <entry>March</entry>
1091 <entry>November</entry>
1095 <entry>October</entry>
1099 <entry>September</entry>
1100 <entry>Sep, Sept</entry>
1108 The month <literal>May</literal> has no explicit abbreviation, for obvious reasons.
1114 <table tocentry="1">
1115 <title><productname>Postgres</productname> Day of Week Abbreviations</title>
1116 <titleabbrev>Day of Week Abbreviations</titleabbrev>
1121 <entry>Abbreviation</entry>
1126 <entry>Sunday</entry>
1130 <entry>Monday</entry>
1134 <entry>Tuesday</entry>
1135 <entry>Tue, Tues</entry>
1138 <entry>Wednesday</entry>
1139 <entry>Wed, Weds</entry>
1142 <entry>Thursday</entry>
1143 <entry>Thu, Thur, Thurs</entry>
1146 <entry>Friday</entry>
1150 <entry>Saturday</entry>
1159 <table tocentry="1">
1160 <title><productname>Postgres</productname> Time Input</title>
1161 <titleabbrev>Time Inputs</titleabbrev>
1165 <entry>Example</entry>
1166 <entry>Description</entry>
1171 <entry>04:05:06.789</entry>
1172 <entry>ISO-8601, with all time fields</entry>
1175 <entry>04:05:06</entry>
1176 <entry>ISO-8601</entry>
1179 <entry>04:05</entry>
1180 <entry>ISO-8601</entry>
1183 <entry>040506</entry>
1184 <entry>ISO-8601</entry>
1187 <entry>04:05 AM</entry>
1188 <entry>Same as 04:05; AM does not affect value</entry>
1191 <entry>04:05 PM</entry>
1192 <entry>Same as 16:05; input hour must be <= 12</entry>
1196 <entry>Same as 00:00:00</entry>
1200 <entry>Same as 00:00:00</entry>
1203 <entry>allballs</entry>
1204 <entry>Same as 00:00:00</entry>
1212 <table tocentry="1">
1213 <title><productname>Postgres</productname> Time Zone Input</title>
1214 <titleabbrev>Time Zone Inputs</titleabbrev>
1218 <entry>Time Zone</entry>
1219 <entry>Description</entry>
1225 <entry>Pacific Standard Time</entry>
1228 <entry>-8:00</entry>
1229 <entry>ISO-8601 offset for PST</entry>
1233 <entry>ISO-8601 offset for PST</entry>
1237 <entry>ISO-8601 offset for PST</entry>
1245 <table tocentry="1">
1246 <title><productname>Postgres</productname> Recognized Time Zones</title>
1247 <titleabbrev>Time Zones</titleabbrev>
1251 <entry>Time Zone</entry>
1252 <entry>Offset from UTC</entry>
1253 <entry>Description</entry>
1258 <entry>ACSST</entry>
1259 <entry>+10:30 </entry>
1260 <entry>Central Australia Summer Std Time</entry>
1264 <entry>+09:30 </entry>
1265 <entry>Central Australia Std Time</entry>
1269 <entry>-02:00 </entry>
1270 <entry>Atlantic Daylight Time</entry>
1273 <entry>AESST</entry>
1274 <entry>+11:00 </entry>
1275 <entry>Australia Eastern Summer Std Time</entry>
1279 <entry>+10:00 </entry>
1280 <entry>Australia Eastern Std Time</entry>
1284 <entry>-10:00 </entry>
1285 <entry>Alaska-Hawaii Std Time</entry>
1289 <entry>-4:00 </entry>
1290 <entry>Atlantic Std Time (Canada)</entry>
1293 <entry>AWSST</entry>
1294 <entry>+9:00 </entry>
1295 <entry>Australia Western Summer Std Time</entry>
1299 <entry>+8:00 </entry>
1300 <entry>Australia Western Std Time</entry>
1304 <entry>+1:00 </entry>
1305 <entry>British Summer Time</entry>
1309 <entry>+3:00 </entry>
1310 <entry>Baghdad Time</entry>
1314 <entry>+10:30 </entry>
1315 <entry>Central Australia Daylight Savings Time</entry>
1319 <entry>+09:30 </entry>
1320 <entry>Central Australia Std Time</entry>
1324 <entry>-10:00 </entry>
1325 <entry>Central Alaska Time</entry>
1329 <entry>+8:00 </entry>
1330 <entry>China Coastal Time</entry>
1334 <entry>-5:00 </entry>
1335 <entry>Central Daylight Time</entry>
1339 <entry>+1:00 </entry>
1340 <entry>Central European Time</entry>
1343 <entry>CETDST</entry>
1344 <entry>+2:00 </entry>
1345 <entry>Central European Daylight Savings Time</entry>
1349 <entry>+6:00 </entry>
1350 <entry>Central Std Time</entry>
1354 <entry>+1:00 </entry>
1355 <entry>Dansk Normal Tid</entry>
1359 <entry>+1:00 </entry>
1360 <entry>Dansk Standard Time (?)</entry>
1364 <entry>+10:00 </entry>
1365 <entry>East Australian Std Time</entry>
1369 <entry>-4:00 </entry>
1370 <entry>Eastern Daylight Time</entry>
1374 <entry>+2:00 </entry>
1375 <entry>Eastern Europe, USSR Zone 1</entry>
1378 <entry>EETDST</entry>
1379 <entry>+3:00 </entry>
1380 <entry>Eastern Europe Daylight Savings Time</entry>
1384 <entry>-5:00 </entry>
1385 <entry>Eastern Standard Time</entry>
1389 <entry>+1:00 </entry>
1390 <entry>French Summer Time</entry>
1394 <entry>+2:00</entry>
1395 <entry>French Winter Time</entry>
1400 <entry>Greenwish Mean Time</entry>
1404 <entry>+10:00</entry>
1405 <entry>Guam Std Time, USSR Zone 9</entry>
1409 <entry>-9:00</entry>
1410 <entry>Hawaii/Alaska</entry>
1414 <entry>+12:00</entry>
1415 <entry>International Date Line, East</entry>
1419 <entry>-12:00</entry>
1420 <entry>International Date Line, West</entry>
1424 <entry>+2:00</entry>
1425 <entry>Israel</entry>
1429 <entry>+3:40</entry>
1430 <entry>Iran Time</entry>
1434 <entry>+9:00</entry>
1435 <entry>Japan Std Time,USSR Zone 8</entry>
1439 <entry>+7:30</entry>
1440 <entry>Java Time</entry>
1444 <entry>+9:00</entry>
1445 <entry>Korea Standard Time</entry>
1449 <entry>+10:00</entry>
1450 <entry>Melbourne, Australia</entry>
1454 <entry>-6:00</entry>
1455 <entry>Mountain Daylight Time</entry>
1459 <entry>+2:00</entry>
1460 <entry>Middle Europe Summer Time</entry>
1464 <entry>+1:00</entry>
1465 <entry>Middle Europe Time</entry>
1468 <entry>METDST</entry>
1469 <entry>+2:00</entry>
1470 <entry>Middle Europe Daylight Time</entry>
1474 <entry>+1:00</entry>
1475 <entry>Middle Europe Winter Time</entry>
1479 <entry>+1:00</entry>
1480 <entry>Middle Europe Zone</entry>
1484 <entry>-7:00</entry>
1485 <entry>Mountain Standard Time</entry>
1489 <entry>+8:30</entry>
1490 <entry>Moluccas Time</entry>
1494 <entry>-2:30</entry>
1495 <entry>Newfoundland Daylight Time</entry>
1499 <entry>-3:30</entry>
1500 <entry>Newfoundland Standard Time</entry>
1504 <entry>+1:00</entry>
1505 <entry>Norway Standard Time</entry>
1509 <entry>-3:30</entry>
1510 <entry>Newfoundland Standard Time</entry>
1514 <entry>-11:00</entry>
1515 <entry>Nome Time</entry>
1519 <entry>+13:00</entry>
1520 <entry>New Zealand Daylight Time</entry>
1524 <entry>+12:00</entry>
1525 <entry>New Zealand Std Time</entry>
1529 <entry>+12:00</entry>
1530 <entry>New Zealand Time</entry>
1534 <entry>-7:00</entry>
1535 <entry>Pacific Daylight Time</entry>
1539 <entry>-8:00</entry>
1540 <entry>Pacific Std Time</entry>
1544 <entry>+10:30</entry>
1545 <entry>South Australian Daylight Time</entry>
1549 <entry>+9:30</entry>
1550 <entry>South Australian Std Time</entry>
1554 <entry>+1:00</entry>
1555 <entry>Seychelles Time</entry>
1559 <entry>+2:00</entry>
1560 <entry>Swedish Summer Time</entry>
1564 <entry>+1:00</entry>
1565 <entry>Swedish Winter Time</entry>
1569 <entry>+8:00</entry>
1570 <entry>West Australian Daylight Time</entry>
1574 <entry>+7:00</entry>
1575 <entry>West Australian Std Time</entry>
1579 <entry>-1:00</entry>
1580 <entry>West Africa Time</entry>
1584 <entry>+9:00</entry>
1585 <entry>West Australian Daylight Time</entry>
1590 <entry>Western Europe</entry>
1593 <entry>WETDST</entry>
1594 <entry>+1:00</entry>
1595 <entry>Western Europe Daylight Savings Time</entry>
1599 <entry>+8:00</entry>
1600 <entry>West Australian Std Time</entry>
1604 <entry>-8:00</entry>
1605 <entry>Yukon Daylight Time</entry>
1609 <entry>-9:00</entry>
1610 <entry>Yukon Standard Time</entry>
1614 <entry>-4:00</entry>
1615 <entry>GMT +4 hours</entry>
1619 <entry>-5:00</entry>
1620 <entry>GMT +5 hours</entry>
1624 <entry>-6:00</entry>
1625 <entry>GMT +6 hours</entry>
1632 If the compiler option USE_AUSTRALIAN_RULES is set
1633 then <literal>EST</literal> refers to Australia Eastern Std Time,
1634 which has an offset of +10:00 hours from UTC.
1638 It is interesting that Australian time zones and their naming variants
1639 account for fully one quarter of all time zones in the
1640 <productname>Postgres</productname> time zone lookup table.
1646 <title>Date/Time Input Interpretation</title>
1649 Break the input string into tokens and categorize each token as
1650 a string, time, time zone, or number.
1656 If the token contains a colon (":"), this is a time string.
1662 If the token contains a dash ("-"), slash ("/"), or dot ("."),
1663 this is a date string which may have a text month.
1669 If the token is numeric only, then it is either a single field
1670 or an ISO-8601 concatenated date (e.g. "19990113" for January 13, 1999)
1671 or time (e.g. 141516 for 14:15:16).
1676 If the token starts with a plus ("+") or minus ("-"),
1677 then it is either a time zone or a special field.
1685 If the token is a text string, match up with possible strings.
1691 Do a binary-search table lookup for the token
1692 as either a special string (e.g. <literal>today</literal>),
1693 day (e.g. <literal>Thursday</literal>),
1694 month (e.g. <literal>January</literal>), or noise word (e.g. <literal>on</literal>).
1697 Set field values and bit mask for fields.
1698 For example, set year, month, day for <literal>today</literal>, and additionally
1699 hour, minute, second for <literal>now</literal>.
1705 If not found, do a similar binary-search table lookup to match
1706 the token with a time zone.
1712 If not found, throw an error.
1720 The token is a number or number field. If there are more than 4 digits,
1721 and if no other date fields have been previously read, then interpret
1722 as a "concatenated date".
1727 <para>If there </para>
1761 <title>datetime</title>
1764 General-use date and time is input using a wide range of
1765 styles, including ISO-compatible, <acronym>SQL</acronym>-compatible, traditional
1766 <productname>Postgres</productname> (see section on "absolute time")
1767 and other permutations of date and time. Output styles can be ISO-compatible,
1768 <acronym>SQL</acronym>-compatible, or traditional
1769 <productname>Postgres</productname>, with the default set to be compatible
1770 with <productname>Postgres</productname> v6.0.
1774 <type>datetime</type> is specified using the following syntax:
1777 Year-Month-Day [ Hour : Minute : Second ] [AD,BC] [ Timezone ]
1778 YearMonthDay [ Hour : Minute : Second ] [AD,BC] [ Timezone ]
1779 Month Day [ Hour : Minute : Second ] Year [AD,BC] [ Timezone ]
1781 Year is 4013 BC, ..., very large
1782 Month is Jan, Feb, ..., Dec or 1, 2, ..., 12
1783 Day is 1, 2, ..., 31
1784 Hour is 00, 02, ..., 23
1785 Minute is 00, 01, ..., 59
1786 Second is 00, 01, ..., 59 (60 for leap second)
1787 Timezone is 3 characters or ISO offset to GMT
1792 Valid dates are from Nov 13 00:00:00 4013 BC GMT to far into the future.
1793 Timezones are either three characters (e.g. "GMT" or "PST") or ISO-compatible
1794 offsets to GMT (e.g. "-08" or "-08:00" when in Pacific Standard Time).
1795 Dates are stored internally in Greenwich Mean Time. Input and output routines
1796 translate time to the local time zone of the server.
1800 <title><type>timespan</type></title>
1803 General-use time span is input using a wide range of
1804 syntaxes, including ISO-compatible, <acronym>SQL</acronym>-compatible,
1806 <productname>Postgres</productname> (see section on "relative time")
1807 and other permutations of time span. Output formats can be ISO-compatible,
1808 <acronym>SQL</acronym>-compatible, or traditional
1809 <productname>Postgres</productname>,
1810 with the default set to be <productname>Postgres</productname>-compatible.
1811 Months and years are a "qualitative" time interval, and are stored separately
1812 from the other "quantitative" time intervals such as day or hour.
1813 For date arithmetic,
1814 the qualitative time units are instantiated in the context of the
1815 relevant date or time.
1819 Time span is specified with the following syntax:
1822 Quantity Unit [Quantity Unit...] [Direction]
1823 @ Quantity Unit [Direction]
1825 Quantity is ..., <literal>-1</literal>, <literal>0</literal>, <literal>1</literal>, <literal>2</literal>, ...
1826 Unit is <literal>second</literal>, <literal>minute</literal>, <literal>hour</literal>, <literal>day</literal>, <literal>week</literal>, <literal>month</literal>, <literal>year</literal>,
1827 <literal>decade</literal>, <literal>century</literal>, <literal>millenium</literal>, or abbreviations or plurals of these units.
1828 Direction is <literal>ago</literal>.
1834 <title>abstime</title>
1837 Absolute time (<type>abstime</type>) is a limited-range (+/- 68 years) and
1838 limited-precision (1 sec)
1839 date data type. <type>datetime</type> may be preferred, since it
1840 covers a larger range with greater precision.
1844 Absolute time is specified using the following syntax:
1847 Month Day [ Hour : Minute : Second ] Year [ Timezone ]
1849 Month is Jan, Feb, ..., Dec
1850 Day is 1, 2, ..., 31
1851 Hour is 01, 02, ..., 24
1852 Minute is 00, 01, ..., 59
1853 Second is 00, 01, ..., 59
1854 Year is 1901, 1902, ..., 2038
1859 Valid dates are from <literal>Dec 13 20:45:53 1901 GMT</literal>
1860 to <literal>Jan 19 03:14:04 2038 GMT</literal>.
1863 <title>Historical Note</title>
1865 As of Version 3.0, times are no longer read and written
1866 using Greenwich Mean Time; the input and output routines default to
1867 the local time zone.</para>
1870 All special values allowed for <type>datetime</type> are also
1871 allowed for "absolute time".
1877 <title>reltime</title>
1880 Relative time <type>reltime</type> is a limited-range (+/- 68 years)
1881 and limited-precision (1 sec) time span data type.
1882 <type>timespan</type> should be preferred, since it
1883 covers a larger range with greater precision and, more importantly,
1884 can distinguish between
1885 relative units (months and years) and quantitative units (days, hours, etc).
1887 must force months to be exactly 30 days, so time arithmetic does not
1888 always work as expected.
1889 For example, adding one reltime <literal>year</literal> to abstime <literal>today</literal> does not
1890 produce today's date one year from
1891 now, but rather a date 360 days from today.
1895 <type>reltime</type> shares input and output routines with the other
1897 The section on <type>timespan</type> covers this in more detail.
1903 <title><type>timestamp</type></title>
1906 This is currently a limited-range absolute time which closely resembles the
1908 data type. It shares the general input parser with the other date/time types.
1909 In future releases this type will absorb the capabilities of the
1910 <type>datetime</type> type
1911 and will move toward <acronym>SQL92</acronym> compliance.
1915 <type>timestamp</type> is specified using the same syntax as for
1916 <type>datetime</type>.
1921 <title><type>interval</type></title>
1924 <type>interval</type> is an <acronym>SQL92</acronym> data type which is
1925 currently mapped to the <type>timespan</type>
1926 <productname>Postgres</productname> data type.
1931 <title>tinterval</title>
1934 Time ranges are specified as:
1937 [ 'abstime' 'abstime']
1939 abstime is a time in the absolute time format.
1942 Special abstime values such as
1943 <literal>current', <literal>infinity' and <literal>-infinity' can be used.</literal></literal></literal>
1949 <title>Boolean Type</title>
1952 <productname>Postgres</productname> supports <type>bool</type> as
1953 the <acronym>SQL3</acronym> boolean type.
1954 <type>bool</type> can have one of only two states: 'true' or 'false'.
1955 A third state, 'unknown', is not
1956 implemented and is not suggested in <acronym>SQL3</acronym>;
1957 <acronym>NULL</acronym> is an
1958 effective substitute. <type>bool</type> can be used in any boolean expression,
1959 and boolean expressions
1960 always evaluate to a result compatible with this type.</para>
1963 <type>bool</type> uses 4 bytes of storage.
1967 <table tocentry="1">
1968 <title><productname>Postgres</productname> Boolean Type</title>
1969 <titleabbrev>Booleans</titleabbrev>
1973 <entry>State</entry>
1974 <entry>Output</entry>
1975 <entry>Input</entry>
1982 <entry>TRUE, 't', 'true', 'y', 'yes', '1'</entry>
1985 <entry>False</entry>
1987 <entry>FALSE, 'f', 'false', 'n', 'no', '0'</entry>
1996 <title>Geometric Types</title>
1999 Geometric types represent two-dimensional spatial objects.
2000 The most fundamental type,
2001 the point, forms the basis for all of the other types.
2005 <table tocentry="1">
2006 <title><productname>Postgres</productname> Geometric Types</title>
2007 <titleabbrev>Geometrics</titleabbrev>
2011 <entry>Geometric Type</entry>
2012 <entry>Storage</entry>
2013 <entry>Representation</entry>
2014 <entry>Description</entry>
2019 <entry>point</entry>
2020 <entry>16 bytes</entry>
2021 <entry>(x,y)</entry>
2022 <entry>Point in space</entry>
2026 <entry>32 bytes</entry>
2027 <entry>((x1,y1),(x2,y2))</entry>
2028 <entry>Infinite line</entry>
2032 <entry>32 bytes</entry>
2033 <entry>((x1,y1),(x2,y2))</entry>
2034 <entry>Finite line segment</entry>
2038 <entry>32 bytes</entry>
2039 <entry>((x1,y1),(x2,y2))</entry>
2040 <entry>Rectangular box</entry>
2044 <entry>4+32n bytes</entry>
2045 <entry>((x1,y1),...)</entry>
2046 <entry>Closed path (similar to polygon)</entry>
2050 <entry>4+32n bytes</entry>
2051 <entry>[(x1,y1),...]</entry>
2052 <entry>Open path</entry>
2055 <entry>polygon</entry>
2056 <entry>4+32n bytes</entry>
2057 <entry>((x1,y1),...)</entry>
2058 <entry>Polygon (similar to closed path)</entry>
2061 <entry>circle</entry>
2062 <entry>24 bytes</entry>
2063 <entry><(x,y),r></entry>
2064 <entry>Circle (center and radius)</entry>
2072 A rich set of functions and operators is available to perform various geometric
2073 operations such as scaling, translation, rotation, and determining
2078 <title>Point</title>
2081 Points are the fundamental two-dimensional building block for geometric types.
2085 <type>point</type> is specified using the following syntax:
2091 x is the x-axis coordinate as a floating point number
2092 y is the y-axis coordinate as a floating point number
2098 <title>Line Segment</title>
2101 Line segments (lseg) are represented by pairs of points.
2105 <type>lseg</type> is specified using the following syntax:
2107 ( ( x1 , y1 ) , ( x2 , y2 ) )
2108 ( x1 , y1 ) , ( x2 , y2 )
2111 (x1,y1) and (x2,y2) are the endpoints of the segment
2120 Boxes are represented by pairs of points which are opposite
2125 <type>box</type> is specified using the following syntax:
2128 ( ( x1 , y1 ) , ( x2 , y2 ) )
2129 ( x1 , y1 ) , ( x2 , y2 )
2132 (x1,y1) and (x2,y2) are opposite corners
2135 Boxes are output using the first syntax.
2136 The corners are reordered on input to store
2137 the lower left corner first and the upper right corner last.
2138 Other corners of the box can be entered, but the lower
2139 left and upper right corners are determined from the input and stored.
2147 Paths are represented by connected sets of points. Paths can be "open", where
2148 the first and last points in the set are not connected, and "closed",
2149 where the first and last point are connected. Functions
2150 <function>popen(p)</function>
2152 <function>pclose(p)</function>
2153 are supplied to force a path to be open or closed, and functions
2154 <function>isopen(p)</function>
2156 <function>isclosed(p)</function>
2157 are supplied to select either type in a query.
2161 path is specified using the following syntax:
2164 ( ( x1 , y1 ) , ... , ( xn , yn ) )
2165 [ ( x1 , y1 ) , ... , ( xn , yn ) ]
2166 ( x1 , y1 ) , ... , ( xn , yn )
2167 ( x1 , y1 , ... , xn , yn )
2168 x1 , y1 , ... , xn , yn
2170 (x1,y1),...,(xn,yn) are points 1 through n
2171 a leading "[" indicates an open path
2172 a leading "(" indicates a closed path
2174 Paths are output using the first syntax.
2175 Note that <productname>Postgres</productname> versions prior to
2176 v6.1 used a format for paths which had a single leading parenthesis,
2178 an integer count of the number of points, then the list of points followed by a
2179 closing parenthesis.
2180 The built-in function <function>upgradepath</function> is supplied to convert
2181 paths dumped and reloaded from pre-v6.1 databases.
2186 <title>Polygon</title>
2189 Polygons are represented by sets of points. Polygons should probably be
2190 considered equivalent to closed paths, but are stored differently
2191 and have their own set of support routines.
2195 <type>polygon</type> is specified using the following syntax:
2198 ( ( x1 , y1 ) , ... , ( xn , yn ) )
2199 ( x1 , y1 ) , ... , ( xn , yn )
2200 ( x1 , y1 , ... , xn , yn )
2201 x1 , y1 , ... , xn , yn
2203 (x1,y1),...,(xn,yn) are points 1 through n
2206 Polygons are output using the first syntax.
2207 Note that <productname>Postgres</productname> versions prior to
2208 v6.1 used a format for polygons which had a single leading parenthesis, the list
2209 of x-axis coordinates, the list of y-axis coordinates,
2210 followed by a closing parenthesis.
2211 The built-in function <function>upgradepoly</function> is supplied to convert
2212 polygons dumped and reloaded from pre-v6.1 databases.
2217 <title>Circle</title>
2220 Circles are represented by a center point and a radius.
2224 circle is specified using the following syntax:
2232 (x,y) is the center of the circle
2233 r is the radius of the circle
2236 Circles are output using the first syntax.
2243 <title>IP Version 4 Networks and Host Addresses</title>
2246 The <type>cidr</type> type stores networks specified
2247 in <acronym>CIDR</acronym> (Classless Inter-Domain Routing) notation.
2248 The <type>inet</type> type stores hosts and networks in CIDR notation using a simple
2249 variation in representation to represent simple host TCP/IP addresses.
2253 <table tocentry="1">
2254 <title><productname>Postgres</productname>IP Version 4 Types</title>
2255 <titleabbrev>IPV4</titleabbrev>
2259 <entry>IPV4 Type</entry>
2260 <entry>Storage</entry>
2261 <entry>Description</entry>
2262 <entry>Range</entry>
2268 <entry>variable</entry>
2269 <entry>CIDR networks</entry>
2270 <entry>Valid IPV4 CIDR blocks</entry>
2274 <entry>variable</entry>
2275 <entry>nets and hosts</entry>
2276 <entry>Valid IPV4 CIDR blocks</entry>
2287 The <type>cidr</type> type holds a CIDR network.
2288 The format for specifying classless networks is <replaceable class="parameter">x.x.x.x/y</replaceable>
2289 where <replaceable class="parameter">x.x.x.x</replaceable> is the
2290 network and <replaceable class="parameter">/y</replaceable> is the number of bits in the netmask.
2291 If <replaceable class="parameter">/y</replaceable> omitted, it is calculated using assumptions from
2292 the older classfull naming system except that it is extended to include at least
2293 all of the octets in the input.
2297 Here are some examples:
2299 <table tocentry="1">
2300 <title><productname>Postgres</productname>IP Types Examples</title>
2304 <entry>CIDR Input</entry>
2305 <entry>CIDR Displayed</entry>
2310 <entry>192.168.1</entry>
2311 <entry>192.168.1/24</entry>
2314 <entry>192.168</entry>
2315 <entry>192.168.0/24</entry>
2318 <entry>128.1</entry>
2319 <entry>128.1/16</entry>
2323 <entry>128.0/16</entry>
2326 <entry>128.1.2</entry>
2327 <entry>128.1.2/24</entry>
2330 <entry>10.1.2</entry>
2331 <entry>10.1.2/24</entry>
2335 <entry>10.1/16</entry>
2348 <title id="inet-type"><type>inet</type></title>
2351 The <type>inet</type> type is designed to hold, in one field, all of the information
2352 about a host including the CIDR-style subnet that it is in.
2353 Note that if you want to store proper CIDR networks,
2354 you should use the <type>cidr</type> type.
2355 The <type>inet</type> type is similar to the <type>cidr</type> type except that the bits in the
2356 host part can be non-zero.
2357 Functions exist to extract the various elements of the field.
2361 The input format for this function is
2362 <replaceable class="parameter">x.x.x.x/y</replaceable>
2363 where <replaceable class="parameter">x.x.x.x</replaceable> is
2364 an internet host and <replaceable class="parameter">y</replaceable>
2365 is the number of bits in the netmask.
2366 If the <replaceable class="parameter">/y</replaceable> part is left off,
2367 it is treated as <literal>/32</literal>.
2368 On output, the <replaceable class="parameter">/y</replaceable> part is not printed
2369 if it is <literal>/32</literal>.
2370 This allows the type to be used as a straight host type by just leaving off
2377 <!-- Keep this comment at the end of the file
2382 sgml-minimize-attributes:nil
2383 sgml-always-quote-attributes:t
2386 sgml-parent-document:nil
2387 sgml-default-dtd-file:"./reference.ced"
2388 sgml-exposed-tags:nil
2389 sgml-local-catalogs:"/usr/lib/sgml/catalog"
2390 sgml-local-ecat-files:nil