2.2.1. Domains

First, we define some domains that we will use in column definitions.

  1. CREATE DOMAIN D_BOOLEAN AS
  2. SMALLINT
  3. CHECK (VALUE IN (0, 1));
  4. COMMENT ON DOMAIN D_BOOLEAN IS
  5. 'Boolean type. 0 - FALSE, 1- TRUE';
  6. CREATE DOMAIN D_MONEY AS
  7. NUMERIC(15,2);
  8. CREATE DOMAIN D_ZIPCODE AS
  9. CHAR(10) CHARACTER SET UTF8
  10. CHECK (TRIM(TRAILING FROM VALUE) SIMILAR TO '[0-9]+');
  11. COMMENT ON DOMAIN D_ZIPCODE IS
  12. 'Zip code';

BOOLEAN Type

In Firebird 3.0, there is a native BOOLEAN type. Some drivers do not support it, due to its relatively recent appearance in Firebird’s SQL lexicon. With that in mind, our applications will be built on a database that will work with either Firebird 2.5 or Firebird 3.0.

Before Firebird 3, servers could connect clients to databases that were created under older Firebird versions. Firebird 3 can connect only to databases that were created on or restored under Firebird 3.