[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-devel
Subject:    Re: [postgis-devel] Major bug with postgis && operator, affecting topology
From:       Rémi_Cura <remi.cura () gmail ! com>
Date:       2015-06-02 11:55:22
Message-ID: CAJvUf_tqfKL5p4K+eP1ti3w435H3AjfCUAv83jC4PmZpsv9f3A () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Paul committed a (supposed) fix.
I updated my postgis,
and will use this new version to see if the bug happens again.
Many thanks for the super-fast fix !
Cheers,
Rémi-C

2015-06-01 16:18 GMT+02:00 Rémi Cura <remi.cura@gmail.com>:

> Data in the ticket.
> I dropped the topology and recreated it, no more issues.
> Note that I was able to do it because it was a toy database,
> I would have been stuck if seriously using it.
>
> Maybe it has something to do with lot of transaction cancelling (when I
> debug, I raise a lot of exceptions ).
>
> As for the safeguard,
> it is necessary not safe.
>
> I'm not an expert, so it's just a guess.
> Maybe you have to consider
>
>     `Nan > 1` ==> always false , so not safe (your safeguard wouldn't be
> executed)
>
> It could be because `ntuples_max` is 0 or NaN.
> Then you have `selectivity = val / ntuples_max;`
> In my case there is no row to return anyway.
>
> Maybe you should put selectivity to `0.5` if NaN or Infinity?
>
>
> Cheers,
> Rémi-C
>
> 2015-06-01 15:52 GMT+02:00 Paul Ramsey <pramsey@cleverelephant.ca>:
>
>> Because by inspection, I don't see how anything gets past this:
>>
>>
>> https://github.com/postgis/postgis/blob/svn-trunk/postgis/gserialized_estimate.c#L1094-L1096
>>
>> On Mon, Jun 1, 2015 at 6:49 AM, Paul Ramsey <pramsey@cleverelephant.ca>
>> wrote:
>> > Reproduction data?
>> > P
>> >
>> >
>> > --
>> > http://postgis.net
>> > http://cleverelephant.ca
>> >
>> >
>> > On June 1, 2015 at 6:47:27 AM, Rémi Cura (remi.cura@gmail.com) wrote:
>> >> Hey,
>> >> I re-opened the ticket [here](
>> >> http://trac.osgeo.org/postgis/ticket/2543#comment:21).
>> >>
>> >> This is a major bug (in my opinion).
>> >>
>> >>
>> >> Simply doing something like
>> >> ------
>> >> SELECT *
>> >> FROM node, face
>> >> WHERE geom && mbr
>> >> --------
>> >>
>> >> raises an error
>> >> "ERROR: invalid join selectivity:"
>> >> (answer should be None, tables have one line each! )
>> >>
>> >> This is pretty terrible, because spatial intersect is at the basis of
>> >> PostGIS, and it affects classical PostGIS topology tables, so it is not
>> >> possible to change the tables easily.
>> >>
>> >> Worse, it affects a pretty recent PostGIS version (POSTGIS="2.2.0dev
>> >> r12846" GEOS="3.5.0dev-CAPI-1.9.0 r0" PROJ="Rel. 4.8.0, 6 March 2012"
>> >> GDAL="GDAL 2.0.0dev, released 2014/04/16" LIBXML="2.8.0" TOPOLOGY
>> RASTER),
>> >> with Postgres 9.3 and Ubuntu 12.04.
>> >>
>> >> Cheers,
>> >> Remi-C
>> >> _______________________________________________
>> >> postgis-devel mailing list
>> >> postgis-devel@lists.osgeo.org
>> >> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-devel
>> >
>>
>
>

[Attachment #5 (text/html)]

<div dir="ltr"><div class="gmail_default" \
style="font-family:monospace,monospace">Paul committed a (supposed) \
fix.<br></div><div class="gmail_default" style="font-family:monospace,monospace">I \
updated my postgis, <br></div><div class="gmail_default" \
style="font-family:monospace,monospace">and will use this new version to see if the \
bug happens again.<br></div><div class="gmail_default" \
style="font-family:monospace,monospace">Many thanks for the super-fast fix ! \
<br>Cheers,<br></div><div class="gmail_default" \
style="font-family:monospace,monospace">Rémi-C<br></div></div><div \
class="gmail_extra"><br><div class="gmail_quote">2015-06-01 16:18 GMT+02:00 Rémi \
Cura <span dir="ltr">&lt;<a href="mailto:remi.cura@gmail.com" \
target="_blank">remi.cura@gmail.com</a>&gt;</span>:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" \
style="font-family:monospace,monospace">Data in the ticket.<br></div><div \
class="gmail_default" style="font-family:monospace,monospace">I dropped the topology \
and recreated it, no more issues.<br></div><div class="gmail_default" \
style="font-family:monospace,monospace">Note that I was able to do it because it was \
a toy database, <br></div><div class="gmail_default" \
style="font-family:monospace,monospace">I would have been stuck if seriously using \
it.<br><br></div><div class="gmail_default" \
style="font-family:monospace,monospace">Maybe it has something to do with lot of \
transaction cancelling (when I debug, I raise a lot of exceptions ).<br></div><div \
class="gmail_default" style="font-family:monospace,monospace"><br></div><div \
class="gmail_default" style="font-family:monospace,monospace">As for the \
safeguard,<br></div><div class="gmail_default" \
style="font-family:monospace,monospace">it is necessary not safe. <br></div><div \
class="gmail_default" style="font-family:monospace,monospace"><br></div><div \
class="gmail_default" style="font-family:monospace,monospace">I&#39;m not an expert, \
so it&#39;s just a guess.<br>Maybe you have to consider<br></div><div \
class="gmail_default" style="font-family:monospace,monospace"><br>       `Nan &gt; 1` \
==&gt; always false , so not safe (your safeguard wouldn&#39;t be \
executed)<br></div><div class="gmail_default" \
style="font-family:monospace,monospace"><br></div><div class="gmail_default" \
style="font-family:monospace,monospace">It could be because `ntuples_max` is 0 or \
NaN. <br></div><div class="gmail_default" \
style="font-family:monospace,monospace">Then you have `selectivity = val / \
ntuples_max;`<br></div><div class="gmail_default" \
style="font-family:monospace,monospace">In my case there is no row to return \
anyway.<br><br></div><div class="gmail_default" \
style="font-family:monospace,monospace">Maybe you should put selectivity  to `0.5` if \
NaN or Infinity?<br></div><div class="gmail_default" \
style="font-family:monospace,monospace"><br><br></div><div class="gmail_default" \
style="font-family:monospace,monospace">Cheers,<br></div><div class="gmail_default" \
style="font-family:monospace,monospace">Rémi-C<br></div></div><div \
class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div \
class="gmail_quote">2015-06-01 15:52 GMT+02:00 Paul Ramsey <span dir="ltr">&lt;<a \
href="mailto:pramsey@cleverelephant.ca" \
target="_blank">pramsey@cleverelephant.ca</a>&gt;</span>:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">Because by inspection, I don&#39;t see how anything gets past \
this:<br> <br>
<a href="https://github.com/postgis/postgis/blob/svn-trunk/postgis/gserialized_estimate.c#L1094-L1096" \
target="_blank">https://github.com/postgis/postgis/blob/svn-trunk/postgis/gserialized_estimate.c#L1094-L1096</a><br>
 <div><div><br>
On Mon, Jun 1, 2015 at 6:49 AM, Paul Ramsey &lt;<a \
href="mailto:pramsey@cleverelephant.ca" \
target="_blank">pramsey@cleverelephant.ca</a>&gt; wrote:<br> &gt; Reproduction \
data?<br> &gt; P<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; <a href="http://postgis.net" target="_blank">http://postgis.net</a><br>
&gt; <a href="http://cleverelephant.ca" \
target="_blank">http://cleverelephant.ca</a><br> &gt;<br>
&gt;<br>
&gt; On June 1, 2015 at 6:47:27 AM, Rémi Cura (<a href="mailto:remi.cura@gmail.com" \
target="_blank">remi.cura@gmail.com</a>) wrote:<br> &gt;&gt; Hey,<br>
&gt;&gt; I re-opened the ticket [here](<br>
&gt;&gt; <a href="http://trac.osgeo.org/postgis/ticket/2543#comment:21" \
target="_blank">http://trac.osgeo.org/postgis/ticket/2543#comment:21</a>).<br> \
&gt;&gt;<br> &gt;&gt; This is a major bug (in my opinion).<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Simply doing something like<br>
&gt;&gt; ------<br>
&gt;&gt; SELECT *<br>
&gt;&gt; FROM node, face<br>
&gt;&gt; WHERE geom &amp;&amp; mbr<br>
&gt;&gt; --------<br>
&gt;&gt;<br>
&gt;&gt; raises an error<br>
&gt;&gt; &quot;ERROR: invalid join selectivity:&quot;<br>
&gt;&gt; (answer should be None, tables have one line each! )<br>
&gt;&gt;<br>
&gt;&gt; This is pretty terrible, because spatial intersect is at the basis of<br>
&gt;&gt; PostGIS, and it affects classical PostGIS topology tables, so it is not<br>
&gt;&gt; possible to change the tables easily.<br>
&gt;&gt;<br>
&gt;&gt; Worse, it affects a pretty recent PostGIS version \
(POSTGIS=&quot;2.2.0dev<br> &gt;&gt; r12846&quot; GEOS=&quot;3.5.0dev-CAPI-1.9.0 \
r0&quot; PROJ=&quot;Rel. 4.8.0, 6 March 2012&quot;<br> &gt;&gt; GDAL=&quot;GDAL \
2.0.0dev, released 2014/04/16&quot; LIBXML=&quot;2.8.0&quot; TOPOLOGY RASTER),<br> \
&gt;&gt; with Postgres 9.3 and Ubuntu 12.04.<br> &gt;&gt;<br>
&gt;&gt; Cheers,<br>
&gt;&gt; Remi-C<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; postgis-devel mailing list<br>
&gt;&gt; <a href="mailto:postgis-devel@lists.osgeo.org" \
target="_blank">postgis-devel@lists.osgeo.org</a><br> &gt;&gt; <a \
href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-devel" \
target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-devel</a><br> \
&gt;<br> </div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>



_______________________________________________
postgis-devel mailing list
postgis-devel@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic