Scalar Types​

This section describes the SDL declarations pertaining to scalar types.

Example​

Declare a new non-negative integer type:

  1. scalar type posint64 extending int64 {
  2. constraint min_value(0);
  3. }

Syntax​

Define a new scalar type corresponding to the more explicit DDL commands.

  1. [abstract] scalar type TypeName [extending supertype [, ...] ]
  2. [ "{"
  3. [ annotation-declarations ]
  4. [ constraint-declarations ]
  5. ...
  6. "}" ]

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.