|
1 | 1 | <!--
|
2 |
| -$Header: /cvsroot/pgsql/doc/src/sgml/extend.sgml,v 1.25 2003/09/11 21:42:19 momjian Exp $ |
| 2 | +$Header: /cvsroot/pgsql/doc/src/sgml/extend.sgml,v 1.26 2003/11/12 22:47:47 petere Exp $ |
3 | 3 | -->
|
4 | 4 |
|
5 | 5 | <chapter id="extend">
|
@@ -105,52 +105,74 @@ $Header: /cvsroot/pgsql/doc/src/sgml/extend.sgml,v 1.25 2003/09/11 21:42:19 momj
|
105 | 105 |
|
106 | 106 | <para>
|
107 | 107 | <productname>PostgreSQL</productname> data types are divided into base
|
108 |
| - types, composite types, domain types, and pseudo-types. |
| 108 | + types, composite types, domains, and pseudo-types. |
109 | 109 | </para>
|
110 | 110 |
|
111 |
| - <para> |
112 |
| - Base types are those, like <type>int4</type>, that are implemented |
113 |
| - below the level of the <acronym>SQL</> language (typically in a low-level |
114 |
| - language such as C). They generally correspond to |
115 |
| - what are often known as abstract data types. |
116 |
| - <productname>PostgreSQL</productname> |
117 |
| - can only operate on such types through functions provided |
118 |
| - by the user and only understands the behavior of such |
119 |
| - types to the extent that the user describes them. Base types are |
120 |
| - further subdivided into scalar and array types. For each scalar type, |
121 |
| - a corresponding array type is automatically created that can hold |
122 |
| - variable-size arrays of that scalar type. |
123 |
| - </para> |
| 111 | + <sect2> |
| 112 | + <title>Base Types</title> |
124 | 113 |
|
125 |
| - <para> |
126 |
| - Composite types, or row types, are created whenever the user creates a |
127 |
| - table; it's also possible to define a <quote>stand-alone</> composite |
128 |
| - type with no associated table. A composite type is simply a list of |
129 |
| - base types with associated field names. A value of a composite type |
130 |
| - is a row or record of field values. The user can access the component |
131 |
| - fields from <acronym>SQL</> queries. |
132 |
| - </para> |
| 114 | + <para> |
| 115 | + Base types are those, like <type>int4</type>, that are |
| 116 | + implemented below the level of the <acronym>SQL</> language |
| 117 | + (typically in a low-level language such as C). They generally |
| 118 | + correspond to what are often known as abstract data types. |
| 119 | + <productname>PostgreSQL</productname> can only operate on such |
| 120 | + types through functions provided by the user and only understands |
| 121 | + the behavior of such types to the extent that the user describes |
| 122 | + them. Base types are further subdivided into scalar and array |
| 123 | + types. For each scalar type, a corresponding array type is |
| 124 | + automatically created that can hold variable-size arrays of that |
| 125 | + scalar type. |
| 126 | + </para> |
| 127 | + </sect2> |
133 | 128 |
|
134 |
| - <para> |
135 |
| - A domain type is based on a particular base |
136 |
| - type and for many purposes is interchangeable with its base type. |
137 |
| - However, a domain may have constraints that restrict its valid values |
138 |
| - to a subset of what the underlying base type would allow. Domains can |
139 |
| - be created by simple <acronym>SQL</> commands. |
140 |
| - </para> |
| 129 | + <sect2> |
| 130 | + <title>Composite Types</title> |
141 | 131 |
|
142 |
| - <para> |
143 |
| - Finally, there are a few <quote>pseudo-types</> for special purposes. |
144 |
| - Pseudo-types cannot appear as fields of tables or composite types, but |
145 |
| - they can be used to declare the argument and result types of functions. |
146 |
| - This provides a mechanism within the type system to identify special |
147 |
| - classes of functions. <xref |
148 |
| - linkend="datatype-pseudotypes-table"> lists the existing |
149 |
| - pseudo-types. |
150 |
| - </para> |
| 132 | + <para> |
| 133 | + Composite types, or row types, are created whenever the user |
| 134 | + creates a table; it's also possible to define a |
| 135 | + <quote>stand-alone</> composite type with no associated table. A |
| 136 | + composite type is simply a list of base types with associated |
| 137 | + field names. A value of a composite type is a row or record of |
| 138 | + field values. The user can access the component fields from |
| 139 | + <acronym>SQL</> queries. |
| 140 | + </para> |
| 141 | + </sect2> |
| 142 | + |
| 143 | + <sect2> |
| 144 | + <title>Domains</title> |
| 145 | + |
| 146 | + <para> |
| 147 | + A domain is based on a particular base type and for many purposes |
| 148 | + is interchangeable with its base type. However, a domain may |
| 149 | + have constraints that restrict its valid values to a subset of |
| 150 | + what the underlying base type would allow. |
| 151 | + </para> |
| 152 | + |
| 153 | + <para> |
| 154 | + Domains can be created using the <acronym>SQL</> commands |
| 155 | + <command>CREATE DOMAIN</command>. Their creation and use is not |
| 156 | + discussed in this chapter. |
| 157 | + </para> |
| 158 | + </sect2> |
| 159 | + |
| 160 | + <sect2> |
| 161 | + <title>Pseudo-Types</title> |
| 162 | + |
| 163 | + <para> |
| 164 | + There are a few <quote>pseudo-types</> for special purposes. |
| 165 | + Pseudo-types cannot appear as columns of tables or attributes of |
| 166 | + composite types, but they can be used to declare the argument and |
| 167 | + result types of functions. This provides a mechanism within the |
| 168 | + type system to identify special classes of functions. <xref |
| 169 | + linkend="datatype-pseudotypes-table"> lists the existing |
| 170 | + pseudo-types. |
| 171 | + </para> |
| 172 | + </sect2> |
151 | 173 |
|
152 | 174 | <sect2 id="extend-types-polymorphic">
|
153 |
| - <title>Polymorphic Types and Functions</title> |
| 175 | + <title>Polymorphic Types</title> |
154 | 176 |
|
155 | 177 | <indexterm zone="extend-types-polymorphic">
|
156 | 178 | <primary>polymorphic type</primary>
|
|
0 commit comments