 create table lithostratigraphy
        (
         id integer not null default nextval('lithostratigraphy_id_seq'),
-        group_ref classifications_ids,
+        group_ref integer default 0 not null,
         group_indexed classifications_names,
-        formation_ref classifications_ids,
+        formation_ref integer default 0 not null,
         formation_indexed classifications_names,
-        member_ref classifications_ids,
+        member_ref integer default 0 not null,
         member_indexed classifications_names,
-        layer_ref classifications_ids,
+        layer_ref integer default 0 not null,
         layer_indexed classifications_names,
-        sub_level_1_ref classifications_ids,
+        sub_level_1_ref integer default 0 not null,
         sub_level_1_indexed classifications_names,
-        sub_level_2_ref classifications_ids,
+        sub_level_2_ref integer default 0 not null,
         sub_level_2_indexed classifications_names,
         constraint pk_lithostratigraphy primary key (id),
         constraint unq_lithostratigraphy unique (path, name_indexed, level_ref),

create table chronostratigraphy
       (
        id integer not null default nextval('chronostratigraphy_id_seq'),
        eon_ref classifications_ids,
        eon_indexed classifications_names,
        era_ref classifications_ids,
        era_indexed classifications_names,
        sub_era_ref classifications_ids,
        sub_era_indexed classifications_names,
        system_ref classifications_ids,
        system_indexed classifications_names,
        serie_ref classifications_ids,
        serie_indexed classifications_names,
        stage_ref classifications_ids,
        stage_indexed classifications_names,
        sub_stage_ref classifications_ids,
        sub_stage_indexed classifications_names,
        sub_level_1_ref classifications_ids,
        sub_level_1_indexed classifications_names,
        sub_level_2_ref classifications_ids,
        sub_level_2_indexed classifications_names,
        lower_bound numeric,
        upper_bound numeric,

create table lithology
       (
        id integer not null default nextval('lithology_id_seq'),
        unit_main_group_ref integer default 0 not null,
        unit_main_group_indexed classifications_names,
        unit_group_ref integer default 0 not null,
        unit_group_indexed classifications_names,
        unit_sub_group_ref integer default 0 not null,
        unit_sub_group_indexed classifications_names,
        unit_rock_ref integer default 0 not null,
        unit_rock_indexed classifications_names,
        constraint pk_lithology primary key (id),
        constraint unq_lithology unique (path, name_indexed, level_ref),
