I have 2 tables "dijkstra_results_geo" and "dijkstra_results_geo_aggregate".
I have a set of Linestrings in the column dijkstra_results_geo.geom_path_intermediaire (defined as geometry(Linestring, 4326)).

I would like to collect all these Linestrings into one big Multilinestring in the column dijkstra_results_geo_aggregate.path (1 row with gid=1).
I tried :

 UPDATE dijkstra_results_geo_aggregate  
 SET path = (SELECT St_Union(dijkstra_results_geo.geom_path_intermediaire)  
FROM dijkstra_results_geo)
 WHERE gid=1;

The query works but the "path" column (defined as geometry(Multilinestring, 4326)) remains empty.

I also tried to use St_Collect but it's empty as well.

I finally tried the query with the "path" and "geom_path_intermediaire" columns defined as "geometry", but it's the same.
Could you please help me?

  • 1
    Have you tried ST_Multi ? postgis.org/docs/ST_Multi.html Commented May 16, 2016 at 8:51
  • Yes, I get : "0105000020E610000057000000010200000002000000000000001E8F2741000000801B6B5A410000000018982741000000C09C6A5A410102000000020000000000000066A82741000000C0FF6C5A410000000094C2274100000080AA6E5A410102000000020000000000000018982741000000C09C6A5A410000000012A52741 (...)"
    – user37103
    Commented May 16, 2016 at 9:03
  • If I try st_Multi, I get : "ERREUR: plus d'une ligne renvoyée par une sous-requête utilisée comme une expression" (it means there are several rows as result so it can't fit into one row.)
    – user37103
    Commented May 16, 2016 at 9:07

1 Answer 1


Ok, I succeded with :

UPDATE dijkstra_results_geo_aggregate  
SET path = (SELECT st_LineMerge(St_Union(dijkstra_results_geo.geom_path_intermediaire))   
FROM dijkstra_results_geo)
WHERE gid=1;

Thanks you so much for your help! ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.