1
1
<!--
2
- $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_type.sgml,v 1.22 2001/09/1315:55:24 petere Exp $
2
+ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_type.sgml,v 1.23 2001/09/1319:05:29 petere Exp $
3
3
Postgres documentation
4
4
-->
5
5
@@ -210,7 +210,7 @@ CREATE
210
210
211
211
<para>
212
212
<command>CREATE TYPE</command> allows the user to register a new user data
213
- type withPostgres for use in the current data base. The
213
+ type withPostgreSQL for use in the current data base. The
214
214
user who defines a type becomes its owner.
215
215
<replaceable class="parameter">typename</replaceable> is
216
216
the name of the new type and must be unique within the
@@ -235,9 +235,9 @@ CREATE
235
235
New base data types can be fixed length, in which case
236
236
<replaceable class="parameter">internallength</replaceable> is a
237
237
positive integer, or variable length,
238
- in which casePostgres assumes that the new type has the
238
+ in which casePostgreSQL assumes that the new type has the
239
239
same format
240
- as thePostgres -supplied data type, <type>text</type>.
240
+ as thePostgreSQL -supplied data type, <type>text</type>.
241
241
To indicate that a type is variable length, set
242
242
<replaceable class="parameter">internallength</replaceable>
243
243
to <option>VARIABLE</option>.
@@ -274,9 +274,9 @@ CREATE
274
274
The optional arguments
275
275
<replaceable class="parameter">send_function</replaceable> and
276
276
<replaceable class="parameter">receive_function</replaceable>
277
- are used when the application program requestingPostgres
277
+ are used when the application program requestingPostgreSQL
278
278
services resides on a different machine. In this case,
279
- the machine on whichPostgres runs may use a format for the data
279
+ the machine on whichPostgreSQL runs may use a format for the data
280
280
type different from that used on the remote machine.
281
281
In this case it is appropriate to convert data items to a
282
282
standard form when sending from the server to the client
@@ -327,91 +327,79 @@ CREATE
327
327
Two generalized built-in functions, array_in and
328
328
array_out, exist for quick creation of variable-length
329
329
array types. These functions operate on arrays of any
330
- existingPostgres type.
330
+ existingPostgreSQL type.
331
331
</para>
332
332
</refsect2>
333
-
334
333
</refsect1>
335
334
335
+ <refsect1 id="SQL-CREATETYPE-notes">
336
+ <title>Notes</title>
337
+
338
+ <para>
339
+ Type names cannot begin with the underscore character
340
+ (<quote><literal>_</literal></quote>) and can only be 31
341
+ characters long. This is because PostgreSQL silently creates an
342
+ array type for each base type with a name consisting of the base
343
+ type's name prepended with an underscore.
344
+ </para>
345
+ </refsect1>
346
+
336
347
<refsect1>
337
348
<title>Examples</title>
338
349
<para>
339
- This command creates the box data type and then uses the
350
+ This command creates the<type> box</type> data type and then uses the
340
351
type in a table definition:
341
- <programlisting>
352
+ <programlisting>
342
353
CREATE TYPE box (INTERNALLENGTH = 8,
343
354
INPUT = my_procedure_1, OUTPUT = my_procedure_2);
344
355
CREATE TABLE myboxes (id INT4, description box);
345
- </programlisting>
356
+ </programlisting>
346
357
</para>
347
358
348
359
<para>
349
360
This command creates a variable length array type with
350
- integer elements:
361
+ <type> integer</type> elements:
351
362
352
- <programlisting>
363
+ <programlisting>
353
364
CREATE TYPE int4array (INPUT = array_in, OUTPUT = array_out,
354
365
INTERNALLENGTH = VARIABLE, ELEMENT = int4);
355
366
CREATE TABLE myarrays (id int4, numbers int4array);
356
- </programlisting>
367
+ </programlisting>
357
368
</para>
358
369
359
370
<para>
360
371
This command creates a large object type and uses it in
361
372
a table definition:
362
373
363
- <programlisting>
374
+ <programlisting>
364
375
CREATE TYPE bigobj (INPUT = lo_filein, OUTPUT = lo_fileout,
365
376
INTERNALLENGTH = VARIABLE);
366
377
CREATE TABLE big_objs (id int4, obj bigobj);
367
- </programlisting>
378
+ </programlisting>
368
379
</para>
380
+ </refsect1>
369
381
370
- <refsect2 id="R2-SQL-CREATETYPE-3">
371
- <refsect2info>
372
- <date>1998-09-21</date>
373
- </refsect2info>
374
- <title>
375
- Notes
376
- </title>
377
-
378
- <para>
379
- Type names cannot begin with the underscore character
380
- ("_") and can only be 31 characters long. This is because
381
- Postgres silently creates an array type for each base type
382
- with a name consisting of the base type's name prepended
383
- with an underscore.
384
- </para>
382
+ <refsect1 id="SQL-CREATETYPE-compatibility">
383
+ <title>Compatibility</title>
385
384
386
- <para>
387
- Refer to <command>DROP TYPE</command> to remove an existing type.
388
- </para>
389
- <para>
390
- See also <command>CREATE FUNCTION</command>,
391
- <command>CREATE OPERATOR</command> and the chapter on Large Objects
392
- in the <citetitle>PostgreSQL Programmer's Guide</citetitle>.
393
- </para>
394
- </refsect2>
385
+ <para>
386
+ This <command>CREATE TYPE</command> command is a
387
+ <productname>PostgreSQL</productname> extension. There is a
388
+ <command>CREATE TYPE</command> statement in SQL99 that is rather
389
+ different in detail.
390
+ </para>
395
391
</refsect1>
396
-
397
-
398
- <refsect1 id="R1-SQL-CREATETYPE-3">
399
- <title>
400
- Compatibility
401
- </title>
402
392
403
- <refsect2 id="R2-SQL-CREATETYPE-4">
404
- <refsect2info>
405
- <date>1998-09-21</date>
406
- </refsect2info>
407
- <title>
408
- SQL3
409
- </title>
410
- <para>
411
- <command>CREATE TYPE</command> is an <acronym>SQL3</acronym> statement.
412
- </para>
413
- </refsect2>
393
+ <refsect1 id="SQL-CREATETYPE-see-also">
394
+ <title>See Also</title>
395
+
396
+ <simplelist type="inline">
397
+ <member><xref linkend="sql-createfunction"></member>
398
+ <member><xref linkend="sql-droptype"></member>
399
+ <member><citetitle>PostgreSQL Programmer's Guide</citetitle></member>
400
+ </simplelist>
414
401
</refsect1>
402
+
415
403
</refentry>
416
404
417
405