I want to make a geometry array or a new geometry which is combination of few other geometries. I have one table with id column, geometry column and start_cls column. So, I want to group my ids and geometries based on start_cls value. So, I executed following query.
SELECT array_agg(gid), st_union(geom), start_cls FROM public.edge_table_original group by start_cls limit 20
But in most of the cases, the union of geometry is giving null. I also tried with array_agg(geom) instead of st_union(geom). But the result is same. And I observed when the number of elements in the array is small, then it is giving the value of array_agg and st_union. But if the number of elements are significantly high, then it is not giving. May be there are some character limit problem. How to overcome this problem? I have added the screen shot of data output.
I also checked ST_AsTWKB. But this function returns bytea. But I need geometry or geometry[] output. As I shall use st_makeline on this geometry or geometry[].
1 Answer 1
The maximum size of any Postgres object, including the results of array_agg
, ST_Collect
, and other array-producing aggregates, is 1 GB.
If you hit this limit, these functions won't silently return null. They'll fail with a message like this:
ERROR: array size exceeds the maximum allowed (1073741823).
For what it's worth, this object size limit roughly corresponds to a 2D LineString with 67 million vertices. I wrote a post about this topic a while ago with a few more details.
-
Ha, so, this serves me right for saying no real limit. I would be interested to see how long it would take to do the intersection of two geometries at this limit.John Powell– John Powell2017年02月27日 20:50:36 +00:00Commented Feb 27, 2017 at 20:50
your_table
WHEREyour_geom_column
IS NULL