CREATE FUNCTION gradebook.transcript_traditional_dislist(group_id_ bigint)
RETURNS TABLE(
id bigint,
dis_id bigint,
group_id bigint,
sem integer,
method integer,
ugod_id bigint,
create_iin character varying,
create_date date,
create_time time without time zone,
gr character varying,
index_ru character varying,
name_ru character varying
)
LANGUAGE SQL
AS $$
SELECT m.*,up_d.index_ru,up_d.name_ru FROM gradebook.mains as m
LEFT OUTER JOIN uchast.uplans_dises as up_d ON up_d.id=m.dis_id
WHERE m.group_id=group_id_ ORDER BY up_d.name_ru ASC
$$;