Scalar Types
This section describes the SDL declarations pertaining to scalar types.
Example
Declare a new non-negative integer type:
scalar type posint64 extending int64 {
constraint min_value(0);
}
Syntax
Define a new scalar type corresponding to the more explicit DDL commands.
[abstract] scalar type TypeName [extending supertype [, ...] ]
[ "{"
[ annotation-declarations ]
[ constraint-declarations ]
...
"}" ]
Description
This declaration defines a new object type with the following options:
- abstract
-
If specified, the created scalar type will be abstract.
- TypeName
-
The name (optionally module-qualified) of the new scalar type.
- extending supertype
-
Optional clause specifying the supertype of the new type.
If supertype is an
enumerated type
declaration then an enumerated scalar type is defined.Use of
extending
creates a persistent type relationship between the new subtype and its supertype(s). Schema modifications to the supertype(s) propagate to the subtype.
The valid SDL sub-declarations are listed below:
- annotation-declarations
-
Set scalar type annotation to a given value.
- constraint-declarations
-
Define a concrete constraint for this scalar type.