drop index if exists iszl.ix_t_insured_policy_record_fio;

drop trigger if exists insured_policy_record_fio on iszl.t_insured_policy_record;

alter table iszl.t_insured_policy_record drop column if exists fio;

alter table iszl.t_insured_policy_record
add column fio varchar(122) generated always as (
    replace(
        upper(
            lastname || chr(160) || firstname || coalesce(chr(160) || patronymic, chr(160))
        ),
        'Ё', 
        'Е'
    )
) stored;

create index ix_t_insured_policy_record_fio on iszl.t_insured_policy_record (fio);