-- This view is a possible workaround for the problem
drop view gen_ledg_pr;

--explain analyze
create view gen_ledg_pr as
  select lg.*, pr.anst_id
    from 	subview_A	lg
    join	proj_rel	pr	on pr.prog_id = lg.proj

  union all select lg.*, pr.anst_id
    from 	subview_B	lg
    join	proj_rel	pr	on pr.prog_id = lg.proj

  union all select lg.*, pr.anst_id
    from 	subview_C	lg
    join	proj_rel	pr	on pr.prog_id = lg.proj
;
