Provided by: manpages-zh_1.5.2-1_all bug

NAME

       CREATE TYPE -

SYNOPSIS

       CREATE TYPE name AS
           ( attribute_name data_type [, ... ] )

       CREATE TYPE name (
           INPUT = input_function,
           OUTPUT = output_function
           [ , RECEIVE = receive_function ]
           [ , SEND = send_function ]
           [ , INTERNALLENGTH = { internallength | VARIABLE } ]
           [ , PASSEDBYVALUE ]
           [ , ALIGNMENT = alignment ]
           [ , STORAGE = storage ]
           [ , DEFAULT = default ]
           [ , ELEMENT = element ]
           [ , DELIMITER = delimiter ]
       )

DESCRIPTION

       CREATE TYPE

   COMPOSITE TYPES
         CREATE TYPE    CREATE TYPE

   BASE TYPES
        CREATE   TYPE    CREATE   FUNCTION    input_function   output_function
       receive_function  send_function   C

         input_function   output_function    c_string  c_stringoidinteger    C
       typmod    oid  cstring

          receive_function      internal   internal   oid    StringInfo   ----
       send_function     oid  bytea

           PostgreSQL  "" pg_type  CREATE TYPE

         I/O   PostgreSQL    internallength   internallength    internallength
       VARIABLE  typlen -1

         PASSEDBYVALUE   Datum  4  8

       alignment   124 8  4   int4

       storage   plain plain  extended   main    extended  external

         NULL   DEFAULT   DEFAULT

         ELEMENT   4 (int4)

       ELEMENT = int4

         delimiter  ,

   ARRAY TYPES
        PostgreSQL    foo[]  _foo   array_in  array_out

           ELEMENT  ELEMENT    N    name   char    point   point[0]   point[1]
       array_in  array_out

PARAMETERS

       name

       attribute_name

       data_type

       input_function

       output_function

       receive_function

       send_function

       internallength

       alignment
                char int2 int4  double  int4

       storage
                plainexternal extended main  plain

       default
                NULL

       element

       delimiter

NOTES

        _  62  NAMEDATALEN-2  NAMEDATALEN-1

         PostgreSQL  7.3  opaque  7.3  cstring  opaque CREATE TYPE  opaque

EXAMPLES


       CREATE TYPE compfoo AS (f1 int, f2 text);
       CREATE FUNCTION getfoo() RETURNS SETOF compfoo AS
         'SELECT fooid, fooname FROM foo' LANGUAGE SQL;

        box

       CREATE TYPE box (
           INTERNALLENGTH = 16,
           INPUT = my_box_in_function,
           OUTPUT = my_box_out_function
       );

       CREATE TABLE myboxes (
           id integer,
           description box
       );

         box  float4

       CREATE TYPE box (
           INTERNALLENGTH = 16,
           INPUT = my_box_in_function,
           OUTPUT = my_box_out_function,
           ELEMENT = float4
       );

         box

       CREATE TYPE bigobj (
           INPUT = lo_filein, OUTPUT = lo_fileout,
           INTERNALLENGTH = VARIABLE
       );
       CREATE TABLE big_objs (
           id integer,
           obj bigobj
       );

         Chapter 31``Extending SQL'' in the documentation

COMPATIBILITY

       CREATE TYPE  PostgreSQL  SQL99  CREATE TYPE  PostgreSQL

SEE ALSO

       CREATE FUNCTION [create_function(7)], DROP TYPE [drop_type(l)]

       Postgresql  <laser@pgsqldb.org>