Types Wizard (PostgreSQL)
Go Up to PostgreSQL Object Wizards
This wizard lets you build and submit a CREATE TYPE, creating a new data type to be used in the current database. Optionally, an ALTER TABLE statement can be generated to modify a specific type.
To create a new type using a wizard:
- Open a creation wizard for a type. For details, see Opening an Object Wizard.
- Use the following topics as a guide to setting properties and performing tasks as you pass through the wizard panels:
- Properties panel.
- Range Kind panel.
- Base Kind panel.
- DDL View panel - for details, see Previewing the DDL Generated to Create the New Object.
- Finally, use the Finish button to create the object.
Types (PostgreSQL) - Properties
When creating or editing a type, this tab/panel lets you work with the following settings:
Setting | Description |
---|---|
Schema |
Schema where the new data type is created. |
Name |
Provide a name for the data type being created. |
Kind |
Indicates the kind of data of the data type being created. Options are PSEUDO, BASE, RANGE, ENUM and COMPOSITE. |
Types (PostgreSQL) - Range Kind
Setting | Description |
---|---|
SubtypeSchema |
Schema where the subtype is registered. |
SubtypeName |
Name of the element type that the range type will represent ranges of. |
SubtypeOpClassFunctionSchema |
Schema where the subtype operator class is registered. |
SubtypeOpClassFunctionName |
Name of a b-tree operator class for the subtype. |
SubtypeCollationSchema |
Schema where the collation is registered. |
SubtypeCollationName |
Name of an existing collation to be associated with a range type. |
SubtypeCanonicalFunctionSchema |
Schema where the canonicalization function is registered. |
SubtypeCanonicalFunctionName |
Name of the canonicalization function for the range type. |
SubtypeDiffFunctionSchema |
Schema where the difference function is registered. |
SubtypeDiffFunctionName |
Name of the difference function for the subtype. |
Only SubtypeName is required, the other parameters are optional.
Types (PostgreSQL) - Base kind
Setting | Description |
---|---|
InputFunctionSchema |
Schema where the input function is registered. |
InputFunctionName |
Name of a function that converts data from the type's external textual form to its internal form. |
OutputFunctionSchema |
Schema where the output function is registered. |
OutputFunctionName |
Name of a function that converts data from the internal form of the type to its external textual form. |
RecvFunctionSchema |
Schema where the receive function is registered. |
RecvFunctionName |
Name of a function that converts data from the external binary form of the type to its internal form. |
SendFunctionSchema |
Schema where the Send function is registered. |
SendFunctionName |
Name of a function that converts data from the internal form of the type to its external binary form. |
ModInFunctionSchema |
Schema where the type modifier input function is registered. |
ModInFunctionName |
Name of a function that converts an array of modifier for the types into internal form. |
ModOutFunctionSchema |
Schema where the type modifier output function is registered. |
ModOutFunctionName |
Name of a function that converts the internal form of the type's modifier to an external textual form. |
AnalyzeFunctionSchema |
Schema where the Analyze function is registered. |
AnalyzeFunctionName |
Name of a function that performs statistical analysis for the data type. |
InternalLength |
Numeric constant that specifies the length in bytes of the new type's internal representation. The default assumption is that is is variable-length. |
Alignment |
The storage alignment requirement of the data type. If specified, it must be char, int2, int4, or double; the default is int4. |
PassByValue |
Indicates whether the type can be passed by value or not. By default, is set to false. |
Storage |
The storage strategy for the data type. If specified, it must be plain, external, extended, or main; the default is plain. |
Category |
The category code (a single ASCII character) for this type. The default is 'U' for "user-defined type". Other standard category codes can be found in Table 45-45. You may also choose other ASCII characters in order to create custom categories. |
IsPreferred |
True if this type is a preferred type within its type category, else false. The default is false. Be very careful about creating a new preferred type within an existing type category, as this could cause surprising changes in behavior. |
DefaultValue |
The default value for the data type. If this is omitted, the default is null. |
Delimiter |
The delimiter character to be used between values in arrays made of this type. |
IsCollatable |
Indicates whether the type can use collation information or not. By default is set to false. |
ElementSchema |
Schema where the element is registered. |
ElementName |
The type being created is an array; this specifies the type of the array elements. |
Only InputFunctionName and OutputFunctionName are required, the other parameters are optional.