<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:inherit;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
code
        {mso-style-priority:99;
        font-family:"Courier New";}
pre
        {mso-style-priority:99;
        mso-style-link:"Préformaté HTML Car";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.PrformatHTMLCar
        {mso-style-name:"Préformaté HTML Car";
        mso-style-priority:99;
        mso-style-link:"Préformaté HTML";
        font-family:Consolas;}
span.kwd
        {mso-style-name:kwd;}
span.pln
        {mso-style-name:pln;}
span.pun
        {mso-style-name:pun;}
span.lit
        {mso-style-name:lit;}
span.str
        {mso-style-name:str;}
span.com
        {mso-style-name:com;}
span.EmailStyle26
        {mso-style-type:personal-reply;
        font-family:"Verdana","sans-serif";
        font-variant:normal !important;
        color:#1F497D;
        text-transform:none;
        text-shadow:none;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;
        vertical-align:baseline;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=FR link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>this works : SELECT ('name', ST_GeogFromText('POINT(121.560800 29.901200)'))::place;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'>Olivier<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>De :</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> postgis-users [mailto:postgis-users-bounces@lists.osgeo.org] <b>De la part de</b> Glen Huang<br><b>Envoyé :</b> samedi 21 avril 2018 12:19<br><b>À :</b> postgis-users@lists.osgeo.org<br><b>Objet :</b> [postgis-users] How to specify PostGIS geography value in a composite type literal?<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Hi,<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>I asked this question on SO (<a href="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</a>)<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>but didn’t get much attention. I wonder if someone here could shed some light. <o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Here is the question:<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt;vertical-align:baseline;font-stretch: inherit;line-height:inherit;box-sizing: inherit;caret-color: rgb(36, 39, 41)'><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#242729'>I have a custom composite type:<o:p></o:p></span></p><pre style='background:#EFF0F1;vertical-align:baseline;font-stretch: inherit;line-height:inherit;box-sizing: inherit;max-height: 600px;word-wrap: normal;overflow:auto'><span class=kwd><span style='font-family:"inherit","serif";color:#101094;border:none windowtext 1.0pt;padding:0cm'>CREATE</span></span><span class=pln><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'> TYPE place </span></span><span class=kwd><span style='font-family:"inherit","serif";color:#101094;border:none windowtext 1.0pt;padding:0cm'>AS</span></span><span class=pln><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'> </span></span><span class=pun><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'>(</span></span><span class=pln><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'><o:p></o:p></span></span></pre><pre style='background:#EFF0F1;vertical-align:baseline'><span class=pln><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'>    name text</span></span><span class=pun><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'>,</span></span><span class=pln><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'><o:p></o:p></span></span></pre><pre style='background:#EFF0F1;vertical-align:baseline'><span class=pln><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'>    location geography</span></span><span class=pun><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'>(</span></span><span class=pln><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'>point</span></span><span class=pun><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'>,</span></span><span class=pln><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'> </span></span><span class=lit><span style='font-family:"inherit","serif";color:#7D2727;border:none windowtext 1.0pt;padding:0cm'>4326</span></span><span class=pun><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'>)</span></span><span class=pln><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'><o:p></o:p></span></span></pre><pre style='background:#EFF0F1;vertical-align:baseline'><span class=pun><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'>);</span></span><span style='font-family:Consolas;color:#393318'><o:p></o:p></span></pre><p class=MsoNormal style='margin-bottom:12.0pt;vertical-align:baseline;font-stretch: inherit;line-height:inherit;box-sizing: inherit;caret-color: rgb(36, 39, 41)'><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#242729'>I want to create a value of that type using a composite literal:<o:p></o:p></span></p><pre style='background:#EFF0F1;vertical-align:baseline;font-stretch: inherit;line-height:inherit;box-sizing: inherit;max-height: 600px;word-wrap: normal;overflow:auto'><span class=kwd><span style='font-family:"inherit","serif";color:#101094;border:none windowtext 1.0pt;padding:0cm'>SELECT</span></span><span class=pln><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'> </span></span><span class=pun><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'>$$(</span></span><span class=str><span style='font-family:"inherit","serif";color:#7D2727;border:none windowtext 1.0pt;padding:0cm'>"name"</span></span><span class=pun><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'>,</span></span><span class=pln><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'> </span></span><span class=str><span style='font-family:"inherit","serif";color:#7D2727;border:none windowtext 1.0pt;padding:0cm'>"ST_GeogFromText('POINT(121.560800 29.901200)')"</span></span><span class=pun><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'>)$$::</span></span><span class=pln><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'>place</span></span><span class=pun><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'>;</span></span><span style='font-family:Consolas;color:#393318'><o:p></o:p></span></pre><p class=MsoNormal style='margin-bottom:12.0pt;vertical-align:baseline;font-stretch: inherit;line-height:inherit;box-sizing: inherit;caret-color: rgb(36, 39, 41)'><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#242729'>This fails with:<o:p></o:p></span></p><pre style='background:#EFF0F1;vertical-align:baseline;font-stretch: inherit;line-height:inherit;box-sizing: inherit;max-height: 600px;word-wrap: normal;overflow:auto'><span class=pln><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'>HINT</span></span><span class=pun><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'>:</span></span><span class=pln><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'>  </span></span><span class=str><span style='font-family:"inherit","serif";color:#7D2727;border:none windowtext 1.0pt;padding:0cm'>"ST"</span></span><span class=pln><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'> </span></span><span class=pun><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'><</span></span><span class=com><span style='font-family:"inherit","serif";color:#858C93;border:none windowtext 1.0pt;padding:0cm'>-- parse error at position 2 within geometry</span></span><span class=pln><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'><o:p></o:p></span></span></pre><pre style='background:#EFF0F1;vertical-align:baseline'><span class=pln><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'>ERROR</span></span><span class=pun><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'>:</span></span><span class=pln><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'>  parse error </span></span><span class=pun><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'>-</span></span><span class=pln><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'> invalid geometry</span></span><span style='font-family:Consolas;color:#393318'><o:p></o:p></span></pre><p class=MsoNormal style='margin-bottom:12.0pt;vertical-align:baseline;font-stretch: inherit;line-height:inherit;box-sizing: inherit;caret-color: rgb(36, 39, 41)'><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#242729'>But this executes just fine:<o:p></o:p></span></p><pre style='background:#EFF0F1;vertical-align:baseline;font-stretch: inherit;line-height:inherit;box-sizing: inherit;max-height: 600px;word-wrap: normal;overflow:auto'><span class=kwd><span style='font-family:"inherit","serif";color:#101094;border:none windowtext 1.0pt;padding:0cm'>SELECT</span></span><span class=pln><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'> ST_GeogFromText</span></span><span class=pun><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'>(</span></span><span class=str><span style='font-family:"inherit","serif";color:#7D2727;border:none windowtext 1.0pt;padding:0cm'>'POINT(121.560800 29.901200)'</span></span><span class=pun><span style='font-family:"inherit","serif";color:#303336;border:none windowtext 1.0pt;padding:0cm'>);</span></span><span style='font-family:Consolas;color:#393318'><o:p></o:p></span></pre><p class=MsoNormal style='margin-bottom:12.0pt;vertical-align:baseline;font-stretch: inherit;line-height:inherit;box-sizing: inherit;caret-color: rgb(36, 39, 41)'><span style='font-size:11.5pt;font-family:"Arial","sans-serif";color:#242729'>I wonder what's the correct way to specify PostGIS geography value in a composite type literal?<o:p></o:p></span></p><div><p class=MsoNormal>Thanks<o:p></o:p></p></div></div></div><div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br /> <table style="border-top: 1px solid #D3D4DE;">
        <tr>
      <td style="width: 55px; padding-top: 18px;"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;" /></a></td>
                <td style="width: 470px; padding-top: 17px; color: #41424e; font-size: 13px; font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Garanti sans virus. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank" style="color: #4453ea;">www.avast.com</a>               </td>
        </tr>
</table>
<a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"> </a></div></body></html>