## E.3. Release 9.5.22

Release date: 2020-05-14

This release contains a variety of fixes from 9.5.21. For information about new features in the 9.5 major release, see Section E.25.

The PostgreSQL community will stop releasing updates for the 9.5.X release series in February 2021. Users are encouraged to update to a newer release branch soon.

### E.3.1. Migration to Version 9.5.22

A dump/restore is not required for those running 9.5.X.

However, if you are upgrading from a version earlier than 9.5.20, see Section E.5.

### E.3.2. Changes

- Preserve the `indisclustered` setting of indexes rewritten by `ALTER TABLE` (Amit Langote, Justin Pryzby)

  Previously, `ALTER TABLE` lost track of which index had been used for `CLUSTER`.

- Preserve the replica identity properties of indexes rewritten by `ALTER TABLE` (Quan Zongliang, Peter Eisentraut)

- Lock objects sooner during `DROP OWNED BY` (Álvaro Herrera)

  This avoids failures in race-condition cases where another session is deleting some of the same objects.

- Fix error-case processing for `CREATE ROLE ... IN ROLE` (Andrew Gierth)

  Some error cases would be reported as “unexpected node type” or the like, instead of the intended message.

- Fix bugs in `gin_fuzzy_search_limit` processing (Adé Heyward, Tom Lane)

  A small value of `gin_fuzzy_search_limit` could result in unexpected slowness due to unintentionally rescanning the same index page many times. Another code path failed to apply the intended filtering at all, possibly returning too many values.

- Allow input of type `circle` to accept the format “`(`x`,`y`),`r``” as the documentation says it does (David Zhang)

- Make the `get_bit()` and `set_bit()` functions cope with `bytea` strings longer than 256MB (Movead Li)

  Since the bit number argument is only `int4`, it's impossible to use these functions to access bits beyond the first 256MB of a long `bytea`. We'll widen the argument to `int8` in v13, but in the meantime, allow these functions to work on the initial substring of a long `bytea`.

- Avoid possibly leaking an open-file descriptor for a directory in `pg_ls_dir()`, `pg_timezone_names()`, `pg_tablespace_databases()`, and allied functions (Justin Pryzby)

- Fix polymorphic-function type resolution to correctly infer the actual type of an `anyarray` output when given only an `anyrange` input (Tom Lane)

- Avoid unlikely crash when `REINDEX` is terminated by a session-shutdown signal (Tom Lane)

- Prevent printout of possibly-incorrect hash join table statistics in `EXPLAIN` (Konstantin Knizhnik, Tom Lane, Thomas Munro)

- Fix reporting of elapsed time for heap truncation steps in `VACUUM VERBOSE` (Tatsuhito Kasahara)

- Avoid possibly showing “waiting” twice in a process's PS status (Masahiko Sawada)

- Avoid premature recycling of WAL segments during crash recovery (Jehan-Guillaume de Rorthais)

  WAL segments that become ready to be archived during crash recovery were potentially recycled without being archived.

- Avoid scanning irrelevant timelines during archive recovery (Kyotaro Horiguchi)

  This can eliminate many attempts to fetch non-existent WAL files from archive storage, which is helpful if archive access is slow.

- Remove bogus “subtransaction logged without previous top-level txn record” error check in logical decoding (Arseny Sher, Amit Kapila)

  This condition is legitimately reachable in various scenarios, so remove the check.

- Ensure that a replication slot's `io_in_progress_lock` is released in failure code paths (Pavan Deolasee)

  This could result in a walsender later becoming stuck waiting for the lock.

- Ensure `nextXid` can't go backwards on a standby server (Eka Palamadai)

  This race condition could allow incorrect hot standby feedback messages to be sent back to the primary server, potentially allowing `VACUUM` to run too soon on the primary.

- Add missing SQLSTATE values to a few error reports (Sawada Masahiko)

- Fix PL/pgSQL to reliably refuse to execute an event trigger function as a plain function (Tom Lane)

- Fix memory leak in libpq when using `sslmode=verify-full` (Roman Peshkurov)

  Certificate verification during connection startup could leak some memory. This would become an issue if a client process opened many database connections during its lifetime.

- Fix ecpg to treat an argument of just “`-`” as meaning “read from stdin” on all platforms (Tom Lane)

- Fix pg_dump to dump comments on RLS policy objects (Tom Lane)

- In pg_dump, postpone restore of event triggers till the end (Fabrízio de Royes Mello, Hamid Akhtar, Tom Lane)

  This minimizes the risk that an event trigger could interfere with the restoration of other objects.

- Fix quoting of `--encoding`, `--lc-ctype` and `--lc-collate` values in createdb utility (Michael Paquier)

- `contrib/lo`'s `lo_manage()` function crashed if called directly rather than as a trigger (Tom Lane)

- In `contrib/ltree`, protect against overflow of `ltree` and `lquery` length fields (Nikita Glukhov)

- Fix cache reference leak in `contrib/sepgsql` (Michael Luo)

- Avoid failures when dealing with Unix-style locale names on Windows (Juan José Santamaría Flecha)

- In MSVC builds, cope with spaces in the path name for Python (Victor Wagner)

- In MSVC builds, fix detection of Visual Studio version to work with more language settings (Andrew Dunstan)

- In MSVC builds, use `-Wno-deprecated` with bison versions newer than 3.0, as non-Windows builds already do (Andrew Dunstan)

- Update time zone data files to tzdata release 2020a for DST law changes in Morocco and the Canadian Yukon, plus historical corrections for Shanghai.

  The America/Godthab zone has been renamed to America/Nuuk to reflect current English usage; however, the old name remains available as a compatibility link.

  Also, update initdb's list of known Windows time zone names to include recent additions, improving the odds that it will correctly translate the system time zone setting on that platform.