src: |
  SELECT p_rss_etat.rss_id,
      p_rss_etat.date_groupage,
      date_part('epoch'::text, p_rss_etat.date_groupage) AS date_groupage_id,
      p_rss_etat.date_groupage::text AS date_groupage_code,
      COALESCE(p_calendrier.texte_court, 'Non disponible'::text) AS date_groupage_texte,
      COALESCE(p_calendrier.mois, 209912::numeric) AS date_groupage_mois_id,
      COALESCE(to_char(p_calendrier.mois, 'FM000000'::text), '209912'::text) AS date_groupage_mois_code,
      COALESCE((p_calendrier.mois_texte || ' '::text) || to_char(p_calendrier.iso_annee, 'FM0000'::text), 'Non disponible'::text) AS date_groupage_mois_texte,
      COALESCE(p_calendrier.semaine, 209953::numeric) AS date_groupage_semaine_id,
      COALESCE(to_char(p_calendrier.semaine, 'FM000000'::text), '209953'::text) AS date_groupage_semaine_code,
      COALESCE((('Semaine '::text || to_char(p_calendrier.iso_semaine, 'FM00'::text)) || ' '::text) || to_char(p_calendrier.iso_annee, 'FM0000'::text), 'Non disponible'::text) AS date_groupage_semaine_texte
     FROM pmsi.p_rss_etat
       LEFT JOIN base.p_calendrier ON p_rss_etat.date_groupage = p_calendrier.date;