DROP TABLE spatial.lignes_electriques_merged;
SELECT ("LIBELLE_1"), ST_Union(geom) AS geom
INTO spatial.lignes_electriques_merged
FROM spatial.lignes_electriques
WHERE "LIBELLE_1" <> ''
GROUP BY "LIBELLE_1";
ALTER TABLE spatial.lignes_electriques_merged ADD COLUMN id serial NOT NULL;
ALTER TABLE spatial.lignes_electriques_merged ADD CONSTRAINT pk_le_merges PRIMARY KEY (id)  ;
ALTER TABLE spatial.lignes_electriques_merged OWNER TO ludodo;
GRANT ALL ON TABLE spatial.lignes_electriques_merged TO geomatique;
GRANT SELECT ON TABLE spatial.lignes_electriques_merged TO cpnrc;

CREATE INDEX sidx_lignes_electriques_merged_geom
  ON spatial.lignes_electriques_merged
  USING gist
  (geom);