Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> I spent the last two hours poking arounds in the environment Andrew
> provided and I was able to reproduce the issue, find a assert to
> reproduce it much faster and find a possible root cause.
Hmm ... is this the same thing Josh is reporting? If so, why the
apparent connection with use of pg_stat_statements? Maybe that
just changes the timing to make the race condition more likely?
regards, tom lane