ERROR (internal_error): Operation on mixed SRID geometries

I got this issue when I tried to optimize a pgsql code with postgis.
See the following example that works with if you join it with other sentence:

SELECT ST_SetSRID(ST_MakeLine(ST_MakePoint(4.51, 52.2), ST_MakePoint(23.42, 37.58)),4326)

But, if you only replace ST_MakePoint by a geom selection you will have an error:

SELECT ST_SetSRID(ST_MakeLine( (select point from nodes where name='3'), (select point from nodes where name='20')) ,4326)

ERROR: Operation on mixed SRID geometries SQL state: XX000

To solve it just delete ST_SetSRID as follows:

SELECT ST_MakeLine( (select point from nodes where name='3'), (select point from nodes where name='20'))

Now it works
Enjoy it!

Comments

Popular posts from this blog

Exception: Could not find a default OpenFlow controller in Mininet

How to fix Android when developer options are not available for this user

Webcam streaming throught VLC with YUY2 compatibility