Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR: array size exceeds the maximum allowed (1073741823)

I'm trying to dissolve boundaries of a table of polygons which are ST_Buffers of 5km radius and dump them into another table. The first table contains around 10 million polygons. The table that contains the polygon is:

CREATE TABLE poly_5km(gid serial PRIMARY KEY, bufferType varchar, the_geog geography(POLYGON,4326) );

Here's the table that I want to create:

CREATE TABLE buffer_5km(gid serial PRIMARY KEY, bufferType varchar, the_geog geography(POLYGON,4326) );

INSERT INTO buffer_5km(gid,bufferType,the_geog) VALUES (1,'test',(SELECT (ST_Dump(ST_Multi(ST_Union(ST_MakeValid(poly_5km.the_geog::geometry))))).geom::geography FROM poly_5km WHERE poly_5km.bufferType= 'test'));

But whenever I run the insert statement, I'm getting this error:

ERROR:  array size exceeds the maximum allowed (1073741823)

Can anyone tell me what I'm doing wrong ?

like image 354
Rahul Avatar asked Jul 10 '16 03:07

Rahul


1 Answers

You are trying to store more than 1GB long value. PostgreSQL objects has 1GB limits - you cannot to change it. This limit is same on 32 or 64bit platforms. So you have to change algorithm or granularity.

like image 64
Pavel Stehule Avatar answered Nov 15 '22 07:11

Pavel Stehule