Create Type
Defines a new data type for use in the database.
Synopsis
CREATE TYPE typename ( INPUT = input_function, OUTPUT = output_function , INTERNALLENGTH = { internallength | VARIABLE } [ , EXTERNALLENGTH = { externallength | VARIABLE } ] [ , DEFAULT = "default" ] [ , ELEMENT = element ] [ , DELIMITER = delimiter ] [ , SEND = send_function ] [ , RECEIVE = receive_function ] [ , PASSEDBYVALUE ] [ , ALIGNMENT = alignment ] [ , STORAGE = storage ] )
Parameters
typenameThe name of the new type being created, which may be up to 30 characters in length. All type names must be unique within a database, and may not begin with an underscore (which is reserved for implicit array types).
internallengthThe internal length of the new type, in bytes.
externallengthThe optional external (displayed) length of the new type.
input_functionThe name of the new type’s input function. You must have already defined the function using
CREATE FUNCTION, and it must act to convert data of the type’s external form into the type’s internal form.output_functionThe name of the new type’s output function. This function must convert data of the type’s internal form into its displayable form.
elementThe data type of individual array elements which this type addresses, if you intend to create an array type manually. The
elementmust be fixed-length data type.delimiterThe value delimiter for the implicitly created array associated with the new type (
typename[]).defaultThe default value for the new data type. If you do ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access