create database test;
\c test
create sequence public.cuid_sequence;

create domain public.cuid int8 default nextval('public.cuid_sequence') not null;

create domain public.ts timestamp default now();

create schema data1;


-- cobol integer numeric types

create domain public.pic_9_1 as int2
     default 0
     constraint valid_range check (value between 0 and 9);
     
create domain public.pic_S9_1 as int2
     default 0
     constraint valid_range check (value between -9 and 9);     
     
create domain public.pic_9_2 as int2
     default 0
     constraint valid_range check (value between 0 and 99);
     
create domain public.pic_S9_2 as int2
     default 0
     constraint valid_range check (value between -99 and 99);     
     
create domain public.pic_9_3 as int2
     default 0
     constraint valid_range check (value between 0 and 999);
     
create domain public.pic_S9_3 as int2
     default 0
     constraint valid_range check (value between -999 and 999);     
     
create domain public.pic_9_4 as int2
     default 0
     constraint valid_range check (value between 0 and 9999);
     
create domain public.pic_S9_4 as int2
     default 0
     constraint valid_range check (value between -9999 and 9999);
     
create domain public.pic_9_5 as int4
     default 0
     constraint valid_range check (value between 0 and 99999);
     
create domain public.pic_S9_5 as int4
     default 0
     constraint valid_range check (value between -99999 and 99999);
     
create domain public.pic_9_6 as int4
     default 0
     constraint valid_range check (value between 0 and 999999);
     
create domain public.pic_S9_6 as int4
     default 0
     constraint valid_range check (value between -999999 and 999999);
     
create domain public.pic_9_7 as int4
     default 0
     constraint valid_range check (value between 0 and 9999999);
     
create domain public.pic_S9_7 as int4
     default 0
     constraint valid_range check (value between -9999999 and 9999999);
     
create domain public.pic_9_8 as int4
     default 0
     constraint valid_range check (value between 0 and 99999999);
     
create domain public.pic_S9_8 as int4
     default 0
     constraint valid_range check (value between -99999999 and 99999999);     

create domain public.pic_9_9 as int4
     default 0
     constraint valid_range check (value between 0 and 999999999);
     
create domain public.pic_S9_9 as int4
     default 0
     constraint valid_range check (value between -999999999 and 999999999);     