this works : SELECT ('name', ST_GeogFromText('POINT(121.560800 
29.901200)'))::place;



Olivier



De : postgis-users [mailto:[email protected]] De la part de 
Glen Huang
Envoyé : samedi 21 avril 2018 12:19
À : [email protected]
Objet : [postgis-users] How to specify PostGIS geography value in a composite 
type literal?



Hi,



I asked this question on SO 
(https://stackoverflow.com/questions/49954323/how-to-specify-postgis-geography-value-in-a-composite-type-literal)



but didn’t get much attention. I wonder if someone here could shed some light.



Here is the question:



I have a custom composite type:

CREATE TYPE place AS (
    name text,
    location geography(point, 4326)
);

I want to create a value of that type using a composite literal:

SELECT $$("name", "ST_GeogFromText('POINT(121.560800 29.901200)')")$$::place;

This fails with:

HINT:  "ST" <-- parse error at position 2 within geometry
ERROR:  parse error - invalid geometry

But this executes just fine:

SELECT ST_GeogFromText('POINT(121.560800 29.901200)');

I wonder what's the correct way to specify PostGIS geography value in a 
composite type literal?

Thanks



---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel 
antivirus Avast.
https://www.avast.com/antivirus
_______________________________________________
postgis-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/postgis-users

Reply via email to