I tried the test case in your pull request, but it works fine using Postgresql 9.4. Please create a pull request with a test that reproduces your issue.