[postgis-users] How to specify PostGIS geography value in a composite type literal?

Glen Huang heyhgl at gmail.com
Sat Apr 21 03:43:22 PDT 2018


Thank you!

> On Apr 21, 2018, at 6:42 PM, Olivier Leprêtre <o.lepretre at gmail.com> wrote:
> 
> this works : SELECT ('name', ST_GeogFromText('POINT(121.560800 29.901200)'))::place;
>  
> Olivier
>  
> De : postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] De la part de Glen Huang
> Envoyé : samedi 21 avril 2018 12:19
> À : postgis-users at lists.osgeo.org
> 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 <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
> 
>  <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>	Garanti sans virus. www.avast.com <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> <x-msg://15/#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>_______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org <mailto:postgis-users at lists.osgeo.org>
> https://lists.osgeo.org/mailman/listinfo/postgis-users <https://lists.osgeo.org/mailman/listinfo/postgis-users>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20180421/bd428fff/attachment.html>


More information about the postgis-users mailing list