Re: BUG #13863: Select from views gives wrong results

From: wrb <wrb(at)autistici(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #13863: Select from views gives wrong results
Date: 2016-01-14 19:26:21
Message-ID: E113617B-7B2F-45A8-9FE1-52711308E9D3@autistici.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

<html><head></head><body class="ApplePlainTextBody" dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Ooops, forgot to mail the list.<br><br>W<br><br><blockquote type="cite">Begin forwarded message:<br><br>From: wrb &lt;wrb(at)autistici(dot)org&gt;<br>Subject: Re: [BUGS] BUG #13863: Select from views gives wrong results<br>Date: 14. ledna 2016 10:49:27 SEČ<br>To: Haribabu Kommi &lt;kommi(dot)haribabu(at)gmail(dot)com&gt;<br><br>Followup: <br><br>This query should show better what's wrong with the optimizer:<br><br><br>select a, count(*) &nbsp;from test group by cube (a);<br>a | count <br>---+-------<br>1 | &nbsp;&nbsp;&nbsp;&nbsp;1<br>2 | &nbsp;&nbsp;&nbsp;&nbsp;1<br> &nbsp;| &nbsp;&nbsp;&nbsp;&nbsp;2<br>(3 rows)<br><br>select * from (select a, count(*) &nbsp;from test group by cube (a)) t where a is null;<br>a | count <br>---+-------<br> &nbsp;| &nbsp;&nbsp;&nbsp;&nbsp;0<br><br>explain select * from (select a, count(*) from test group by cube (a)) t where a is null;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;QUERY PLAN &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>------------------------------------------------------------------<br>GroupAggregate &nbsp;(cost=32.79..32.89 rows=2 width=4)<br> &nbsp;Group Key: test.a<br> &nbsp;Group Key: ()<br> &nbsp;Filter: (test.a IS NULL)<br> &nbsp;-&gt; &nbsp;Sort &nbsp;(cost=32.79..32.82 rows=11 width=4)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sort Key: test.a<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&gt; &nbsp;Seq Scan on test &nbsp;(cost=0.00..32.60 rows=11 width=4)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Filter: (a IS NULL)<br><br><br>The predicate "a is null" in the outer select should refer to results of inner select and should therefore return (null, 2) instead of no rows, right?<br><br>W<br></blockquote><br></body></html>

Attachment Content-Type Size
unknown_filename text/html 2.1 KB

Browse pgsql-bugs by date

  From Date Subject
Next Message xtracoder 2016-01-14 20:49:44 BUG #13868: Strange performance of type conversion in jsonb operations
Previous Message bloodjazman 2016-01-14 17:40:49 BUG #13867: apt.postgresql.org broken for postgresql-server-dev-9.4 and libpq-dev