     tag.name tag_name,
     handover_relation.direction, 
     array_agg(
-        (existence.exists, date_part('epoch', existence.timestamp))
+        (existence.exists, date_part('epoch', existence.timestamp))::gis.existence_change
     ) existence
 FROM gis.handover_relation
 JOIN directory.entity src_et ON src_et.id = handover_relation.source_entity_id


GRANT ALL ON TABLE gis.handover_relation TO minerva_admin;
GRANT SELECT ON TABLE gis.handover_relation TO minerva;

CREATE OR REPLACE VIEW gis.handover_relation_existence AS
SELECT

GRANT ALL ON TABLE gis.handoverrelation_tags TO minerva_admin;
GRANT SELECT ON TABLE gis.handoverrelation_tags TO minerva;


CREATE OR REPLACE FUNCTION gis.get_handovers(IN integer)
  RETURNS TABLE(source_id integer, handover_id integer, target_id integer, target_name character varying, source_name character varying, tag_name character varying, direction text, existence text[], handover_tags character varying[]) AS
