<html>
<head>
<!-- Template generated by Exclaimer Signature Manager Exchange Edition on 01:51:29 Monday, 11 February 2019 -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">P.ImprintUniqueID {
        MARGIN: 0cm 0cm 0pt
}
LI.ImprintUniqueID {
        MARGIN: 0cm 0cm 0pt
}
DIV.ImprintUniqueID {
        MARGIN: 0cm 0cm 0pt
}
TABLE.ImprintUniqueIDTable {
        MARGIN: 0cm 0cm 0pt
}
DIV.Section1 {
        page: Section1
}
.ExternalClass * {
        LINE-HEIGHT: 100%
}
</style><style type="text/css" style="display:none"><!--P{margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p class="ImprintUniqueID"></p>
<p>Hi,</p>
<p><br>
</p>
<p>I'm getting an error with an SQL in a mapfile.</p>
<p><br>
</p>
<p>The query works from from the command line:</p>
<p><br>
</p>
<p>select ROW_NUMBER() OVER (order by code) as id, code, sci_name, com_name, lower(family_com)||' ('|| family_sci||')' as Family, point from rdb.species_master s, maps.null_point p where code in (select distinct species from trawl.t_catch) limit 10 ;</p>
<p><br>
</p>
<p>id,code,sci_name,com_name,family,locn<br>
1,AAT,Alainopasiphaea australis,Alainopasiphaea australis,,0101000020E610000000000000000000000000000000000000<br>
</p>
<p>...<br>
</p>
<p><br>
</p>
<p>When embedded in a mapfile & invoked from a browser or QGIS I get an error:</p>
<p><br>
</p>
<p>WFS server error. ms_error->code not found<br>
msPostGISLayerWhichShapes(): Query error. Error executing query.</p>
<p><br>
</p>
<p><br>
</p>
<p>Any suggestions?<br>
</p>
<p><br>
</p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div class="BodyFragment">
<div class="PlainText">Brent Wood<br>
<br>
Programme leader: Environmental Information Delivery<br>
NIWA<br>
DDI:  +64 (4) 3860529</div>
</div>
</div>
</div>
<div style="color: rgb(33, 33, 33);"><span class="x_219225520-05022019"></span><font face="Arial"><font color="#000080"><font size="2"><span class="x_219225520-05022019"></span></font></font></font><font face="Arial"><font color="#000080"><font size="2"><span class="x_219225520-05022019"></span></font></font></font><span style="font-size:10pt; font-family:"Arial",sans-serif; color:navy"></span>
<div>
<div lang="EN-US">
<div class="x_WordSection1">
<div></div>
</div>
</div>
</div>
</div>
<br>
<br>
<table class="ImprintUniqueIDTable" style="HEIGHT: 89px; TABLE-LAYOUT: fixed; WIDTH: 100%" cellspacing="0" cellpadding="0" align="center" border="0">
<tbody>
<tr>
<td style="TABLE-LAYOUT: fixed; WIDTH: 180px"><a href="http://www.niwa.co.nz" target=""><img width="180" height="88" style="border: 0px Solid ; " src="cid:image0b988e.PNG@bcbaef9b.478419bf"></a><br>
<br>
</td>
<td style="TABLE-LAYOUT: fixed; WIDTH: 1159px">
<table cellpadding="0" cellspacing="0" class="d36de3b9-c79e-483e-9a7d-a8e17bfb9614Table">
<tbody>
<tr>
<td nowrap="1"><font style="font-family:Calibri;font-size:10pt;color:#000000;font-weight:bold;">Brent Wood</font></td>
</tr>
<tr>
<td nowrap="1"><font style="font-family:Calibri Light;font-size:9pt;color:#000000;font-weight:bold;">Principal Technician - GIS and Spatial Data Management</font></td>
</tr>
<tr>
<td nowrap="1"><font style="font-family:Calibri Light;font-size:9pt;color:#000000;font-weight:bold;">Programme Leader - Environmental Information Delivery</font></td>
</tr>
<tr>
<td nowrap="1">
<table cellspacing="0" cellpadding="0" class="d36de3b9-c79e-483e-9a7d-a8e17bfb9614Table" style="font-family:Calibri; font-size:9pt;">
<tbody>
<tr>
<td nowrap="1"><font style="font-family:Calibri;font-size:9pt;"><font style="font-family:Calibri;font-size:9pt;"><font style="font-family:Calibri;font-size:9pt;color:#244061;font-weight:bold;">T
</font><font style="font-family:Calibri;font-size:9pt;">+64-4-386-0529</font></font></font></td>
<td nowrap="1" align="Center"><font style="font-family:Calibri;font-size:9pt;"><font style="font-family:Calibri;font-size:9pt;"><font style="font-family:Calibri;font-size:9pt;"> </font></font></font></td>
<td nowrap="1"><font style="font-family:Calibri;font-size:9pt;"><font style="font-family:Calibri;font-size:9pt;"></font></font></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td nowrap="1"><font style="font-family:Calibri;font-size:9pt;color:#000000;">National Institute of Water & Atmospheric Research Ltd (NIWA)</font></td>
</tr>
<tr>
<td nowrap="1"><font style="font-family:Calibri;font-size:9pt;color:#000000;">301 Evans Bay Parade, Greta Point, Wellington</font></td>
</tr>
<tr>
<td nowrap="1"><font style="font-family:Calibri;font-size:9pt;color:#000000;font-weight:bold;">Connect with NIWA:
</font><span style="font-family:Calibri;font-size:9pt;"><a href="https://www.niwa.co.nz" title="" target="" style="font-family:Calibri;font-size:9pt;"><span style="font-family:Calibri; font-size:9pt;">niwa.co.nz</span></a></span><font style="font-family:calibri;font-size:9pt;"> </font><span style="font-family:calibri;font-size:9pt;"><a href="https://www.facebook.com/nzniwa" title="" target="" style="font-family:calibri;font-size:9pt;"><span style="font-family:calibri; font-size:9pt;">Facebook</span></a></span><font style="font-family:Calibri;font-size:9pt;"> </font><span style="font-family:Calibri;font-size:9pt;"><a href="https://twitter.com/niwa_nz" title="" target="" style="font-family:Calibri;font-size:9pt;"><span style="font-family:Calibri; font-size:9pt;">Twitter</span></a></span><font style="font-family:Calibri;font-size:9pt;"> </font><span style="font-family:Calibri;font-size:9pt;"><a href="https://www.linkedin.com/company/niwa" title="" target="" style="font-family:Calibri;font-size:9pt;"><span style="font-family:Calibri; font-size:9pt;">LinkedIn</span></a></span><font style="font-family:Calibri;font-size:9pt;"> </font><span style="font-family:Calibri;font-size:9pt;"><a href="https://www.instagram.com/niwa_science" title="" target="" style="font-family:Calibri;font-size:9pt;"><span style="font-family:Calibri; font-size:9pt;">Instagram</span></a></span></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<table class="ImprintUniqueIDTable" style="HEIGHT: 37px; VERTICAL-ALIGN: bottom; BORDER-COLLAPSE: collapse; TABLE-LAYOUT: auto; WIDTH: 933px" cellspacing="0" cellpadding="0" border="0">
<tbody>
</tbody>
</table>
<table class="ImprintUniqueIDTable" style="HEIGHT: 14px; VERTICAL-ALIGN: bottom; BORDER-COLLAPSE: collapse; TABLE-LAYOUT: auto; WIDTH: 933px" cellspacing="0" cellpadding="0" border="0">
<tbody>
</tbody>
</table>
<table class="ImprintUniqueIDTable" style="BORDER-COLLAPSE: collapse; WIDTH: 100%" cellspacing="0" cellpadding="0" border="0">
<tbody>
</tbody>
</table>
<table class="ImprintUniqueIDTable" style="FONT-SIZE: x-small; FONT-FAMILY: Calibri; TABLE-LAYOUT: fixed" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td><font color="#244061" size="1" face="Calibri">
<table class="d36de3b9-c79e-483e-9a7d-a8e17bfb9614Table">
<tbody>
<tr>
<td><font style="font-family:Calibri;font-size:7pt;color:#244061;"><font style="font-family:Calibri;font-size:8pt;color:#244061;">To ensure compliance with legal requirements and to maintain cyber security standards, NIWA's IT systems are subject to ongoing
 monitoring, activity logging and auditing. This monitoring and auditing service may be provided by third parties. Such third parties can access information transmitted to, processed by and stored on NIWA's IT systems.</font></font></td>
</tr>
</tbody>
</table>
</font></td>
</tr>
</tbody>
</table>
<br>
<table class="ImprintUniqueIDTable" style="BORDER-COLLAPSE: collapse" cellspacing="0" cellpadding="0" border="0">
<tbody>
</tbody>
</table>
<table class="ImprintUniqueIDTable" style="BORDER-COLLAPSE: collapse" cellspacing="0" cellpadding="0" width="500" border="0">
<tbody>
</tbody>
</table>
<br>
<br>
<br>
<p></p>
</body>
</html>