CREATE OR REPLACE VIEW food600.ssksezpopisy
 AS
 SELECT sk__sez.lastuzav AS popis,
    ("substring"(sk__sez.uzaverka::text, 3, 12) || '/'::text) || sk__sez.id_kas::text AS pz2
   FROM food600.sk__sez
  WHERE "substring"(sk__sez.lastuzav::text, 1, 2) = 'D_'::text
UNION
 SELECT nlimit_hl.menolimit AS popis,
    ("substring"(sk__sez.uzaverka::text, 3, 12) || '/'::text) || sk__sez.id_kas::text AS pz2
   FROM food600.sk__sez
     LEFT JOIN food600.nlimit_hl ON "substring"(sk__sez.lastuzav::text, 3, 15)::integer = nlimit_hl.id_limit AND sk__sez.c_data = nlimit_hl.c_data
  WHERE "substring"(sk__sez.lastuzav::text, 1, 2) = 'L_'::text AND btrim("substring"(sk__sez.lastuzav::text, 3)) ~ '^[0-9]'::text;
