Bug in postgres 9.6.2?

From: greigwise <greigwise(at)comcast(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Bug in postgres 9.6.2?
Date: 2017-07-20 17:46:22
Message-ID: 1500572782930-5972185.post@n3.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

So, I have this query with nothing non-deterministic in it, yet I can run it
multiple times and get different results in postgres 9.6.2:

with test as (
select g.id2
from staging a
join dim_1 e on e.id1 = a.id1
and a.created_at >= e.effective_at
and a.created_at < e.expired_at
join dim_2 g on g.id2 = a.id2
and a.created_at >= g.effective_at
and a.created_at < g.expired_at
left join dim_3 i on i.text_field = g.text_field
join dim_4 h on h.id4 = a.id4
and a.created_at >= h.effective_at
and a.created_at < h.expired_at)

select count(*) from test;

Now if I rework this query slightly, it produces a consistent result:

select count(*) from
(
select g.id2
from staging a
join dim_1 e on e.id1 = a.id1
and a.created_at >= e.effective_at
and a.created_at < e.expired_at
join dim_2 g on g.id2 = a.id2
and a.created_at >= g.effective_at
and a.created_at < g.expired_at
left join dim_3 i on i.text_field = g.text_field
join dim_4 h on h.id4 = a.id4
and a.created_at >= h.effective_at
and a.created_at < h.expired_at) as test;

Furthermore, if I run the first query on postgres 9.6.3 rather than 9.6.2,
it also seems to produce a consistent result.

Is it possible that this is a bug in 9.6.2 that was fixed in 9.6.3? Or is
it more likely that somehow just restarting the instance (after doing the
point release upgrade) is what fixed this issue.

Noteworthy is that all the "created_at", "effective_at" and "expired_at"
fields are all timestamp without time zone. All the id's are integers.

Thanks in advance,
Greig Wise

--
View this message in context: http://www.postgresql-archive.org/Bug-in-postgres-9-6-2-tp5972185.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message armand pirvu 2017-07-20 19:07:02 Re: hash join performance question
Previous Message vstuart 2017-07-20 16:04:15 Re: ~/.psqlrc file is ignored [solved: $HOME/.psqlrc]