create view v_basic_person as select i.pk as pk_identity, n.id as n_id, i.title as title, n.firstnames as firstnames, n.lastnames as lastnames, i.dob as dob, i.cob as cob, i.gender as gender, _(i.gender) as l10n_gender, i.karyotype as karyotype, i.pupic as pupic, case when i.fk_marital_status is null then 'unknown' else (select ms.name from marital_status ms, identity i1 where ms.pk=i.fk_marital_status and i1.pk=i.pk) end as marital_status, case when i.fk_marital_status is null then _('unknown') else (select _(ms1.name) from marital_status ms1, identity i1 where ms1.pk=i.fk_marital_status and i1.pk=i.pk) end as l10n_marital_status, i.fk_marital_status as pk_marital_status, n.preferred as preferred, i.xmin as xmin_identity from identity i, names n where i.deceased is NULL and n.active = true and n.id_identity = i.pk ;