New versions: Dev (3.15) | Latest (3.14)

CREATE DOMAIN

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

The CREATE DOMAIN statement allows for creating DOMAIN types for use as data types in table columns.

Depending on the dialect, a DOMAIN combines the following features:

  • A qualified name
  • A base data type
  • A DEFAULT value
  • A NOT NULL constraint
  • A COLLATION
  • A set of CHECK constraints

Domains can be created in jOOQ using:

// Create a domain on a base type
create.createDomain("d1").as(INTEGER).execute();

// Create a domain on a base type and add a DEFAULT expression
create.createDomain("d2").as(INTEGER).default_(1).execute();

// Create a domain on a base type and add a CHECK constraint
create.createDomain("d3").as(INTEGER).constraints(check(value(INTEGER).gt(0))).execute();

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo