<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 15 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:black;}
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;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:black;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
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 bgcolor=white lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>How did you move the extension?<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>And which version are you running.  Since 2.3, PostGIS functions are schema qualified.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>The easiest way is to force a reinstall.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>ALTER EXTENSION  postgis UPDATE;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Should work if you are not running the latest version (one listed in your postgis.control).<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>If it gives you an error something like<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:9.5pt;font-family:Consolas;color:#222222;background:white'>NOTICE: version "2.5.2" of extension "postgis" is already installed<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.5pt;font-family:Consolas;color:#222222;background:white'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:9.5pt;font-family:Consolas;color:#222222;background:white'>Then you can do what I call the yo-yo hack<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.5pt;font-family:Consolas;color:#222222;background:white'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>ALTER EXTENSION postgis UPDATE TO "2.5.2next";;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>Followed by <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'>ALTER EXTENSION postgis UPDATE TO "2.5.2";<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext'>From:</span></b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext'> postgis-users [mailto:postgis-users-bounces@lists.osgeo.org] <b>On Behalf Of </b>Philip M. Hurvitz<br><b>Sent:</b> Friday, July 12, 2019 2:53 PM<br><b>To:</b> postgis-users@lists.osgeo.org; postgis-devel@lists.osgeo.org<br><b>Subject:</b> [postgis-users] ST_Maxdistance schema hardcoding error<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p>Hi all, I found that ST_MaxDistance() was failing for a database that had the PostGIS extension installed in the schema 'postgis'.<o:p></o:p></p><pre>SELECT ST_MaxDistance('POINT(0 0)'::geometry, 'LINESTRING ( 2 0, 0 2 )'::geometry);<o:p></o:p></pre><pre>ERROR:  function public.st_convexhull(geometry) does not exist<o:p></o:p></pre><pre>LINE 1: SELECT public._ST_MaxDistance(public.ST_ConvexHull($1), publ...<o:p></o:p></pre><pre>                                      ^<o:p></o:p></pre><pre>HINT:  No function matches the given name and argument types. You might need to add explicit type casts.<o:p></o:p></pre><pre>QUERY:  SELECT public._ST_MaxDistance(public.ST_ConvexHull($1), public.ST_ConvexHull($2))<o:p></o:p></pre><pre>CONTEXT:  SQL function "st_maxdistance" during startup<o:p></o:p></pre><pre>Time: 147.448 ms<o:p></o:p></pre><p>It seems that the function is expecting to find the ST_ConvexHull function in the public schema.<o:p></o:p></p><p>As a workaround I edited the code for the _ST_MaxDistance and ST_ConvexHull to create identical functions in the public schema and now things work as expected:<o:p></o:p></p><pre>SELECT ST_MaxDistance('POINT(0 0)'::geometry, 'LINESTRING ( 2 0, 0 2 )'::geometry);<o:p></o:p></pre><pre> st_maxdistance <o:p></o:p></pre><pre>----------------<o:p></o:p></pre><pre>              2<o:p></o:p></pre><div><p class=MsoNormal>I had originally installed PostGIS in the public schema but then relocated the extension to the postgis schema -- could this be the reason? Other functions are acting strangely, e.g., postgis_version works OK<o:p></o:p></p></div><div><pre>select postgis_version();<o:p></o:p></pre><pre>            postgis_version            <o:p></o:p></pre><pre>---------------------------------------<o:p></o:p></pre><pre> 2.4 USE_GEOS=1 USE_PROJ=1 USE_STATS=1<o:p></o:p></pre></div><div><p class=MsoNormal>but postgis_full_version fails<o:p></o:p></p></div><div><pre>select postgis_full_version();<o:p></o:p></pre><pre>ERROR:  function public.postgis_lib_version() does not exist<o:p></o:p></pre><pre>LINE 1: SELECT public.postgis_lib_version()<o:p></o:p></pre><pre>               ^<o:p></o:p></pre><pre>HINT:  No function matches the given name and argument types. You might need to add explicit type casts.<o:p></o:p></pre><pre>QUERY:  SELECT public.postgis_lib_version()<o:p></o:p></pre><pre>CONTEXT:  PL/pgSQL function postgis_full_version() line 25 at SQL statement<o:p></o:p></pre></div><div><p class=MsoNormal>Does anyone know if there is a fix for rewriting the functions that are looking in public for functions that are located in the postgis schema?<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Thanks for any info!<o:p></o:p></p></div><div><p class=MsoNormal>-- <o:p></o:p></p><div class=MsoNormal align=center style='text-align:center'><hr size=3 width="100%" align=center></div><p class=MsoNormal>Philip M. Hurvitz<br>Research Assistant Professor, Urban Design and Planning<br>Research Scientist, Civil Engineering (TRAC)<br><a href="http://gis.washington.edu/phurvitz/contact">http://gis.washington.edu/phurvitz/contact</a> <o:p></o:p></p><div class=MsoNormal align=center style='text-align:center'><hr size=3 width="100%" align=center></div></div></div></body></html>