Fix corner-case failures in has_foo_privilege()
family of functions (Tom Lane)

Return NULL rather than throwing an error when an invalid object
OID is provided. Some of these functions got that right already,
but not all. has_column_privilege()
was additionally capable of crashing on some platforms.

This bug affected full-text-search operations, as well as
contrib/ltree and contrib/pg_trgm.

Ensure that sequences owned by a foreign table are processed by
ALTER OWNER on the table (Peter
Eisentraut)

The ownership change should propagate to such sequences as well,
but this was missed for foreign tables.

Fix over-allocation of space for array_out()'s result string (Keiichi Hirobe)

Fix memory leak in repeated SP-GiST index scans (Tom Lane)

This is only known to amount to anything significant in cases
where an exclusion constraint using SP-GiST receives many new index
entries in a single command.

Avoid crash if a utility command causes infinite recursion (Tom
Lane)

When initializing a hot standby, cope with duplicate XIDs caused
by two-phase transactions on the master (Michael Paquier,
Konstantin Knizhnik)

Randomize the random() seed in
bootstrap and standalone backends, and in initdb (Noah Misch)

The main practical effect of this change is that it avoids a
scenario where initdb might
mistakenly conclude that POSIX shared memory is not available, due
to name collisions caused by always using the same random seed.

Don't record foreign-server user mappings as members of
extensions (Tom Lane)

If CREATE USER MAPPING is executed in
an extension script, an extension dependency was created for the
user mapping, which is unexpected. Roles can't be extension
members, so user mappings shouldn't be either.

Make syslogger more robust against failures in opening CSV log
files (Tom Lane)

Previously, some cube-related functions could construct values
that would be rejected by cube_in(),
leading to dump/reload failures.

Fix contrib/unaccent's unaccent() function to use the unaccent text search dictionary that is in the same
schema as the function (Tom Lane)

Previously it tried to look up the dictionary using the search
path, which could fail if the search path has a restrictive
value.

Fix build problems on macOS 10.14 (Mojave) (Tom Lane)

Adjust configure to add an
-isysroot switch to CPPFLAGS; without this, PL/Perl and PL/Tcl fail to
configure or build on macOS 10.14. The specific sysroot used can be
overridden at configure time or build time by setting the
PG_SYSROOT variable in the arguments of
configure or make.

It is now recommended that Perl-related extensions write
$(perl_includespec) rather than -I$(perl_archlibexp)/CORE in their compiler flags.
The latter continues to work on most platforms, but not recent
macOS.

Also, it should no longer be necessary to specify --with-tclconfig manually to get PL/Tcl to build on
recent macOS releases.

Perl no longer includes the current directory in its search path
by default; work around that.

Support building on Windows with Visual Studio 2015 or Visual
Studio 2017 (Michael Paquier, Haribabu Kommi)

Allow btree comparison functions to return INT_MIN (Tom Lane)

Up to now, we've forbidden datatype-specific comparison
functions from returning INT_MIN, which
allows callers to invert the sort order just by negating the
comparison result. However, this was never safe for comparison
functions that directly return the result of memcmp(), strcmp(),
etc, as POSIX doesn't place any such restriction on those
functions. At least some recent versions of memcmp() can return INT_MIN, causing incorrect sort ordering. Hence,
we've removed this restriction. Callers must now use the INVERT_COMPARE_RESULT() macro if they wish to invert
the sort order.

This error could, for example, result in failure to access a
system catalog or index that had just been processed by VACUUM FULL.

This change adds a new result code for LockAcquire, which might possibly affect external
callers of that function, though only very unusual usage patterns
would have an issue with it. The API of LockAcquireExtended is also changed.

This prevents possible interference when one SPI-using function
calls another.

Provide ALLOCSET_DEFAULT_SIZES and
sibling macros in back branches (Tom Lane)

These macros have existed since 9.6, but there were requests to
add them to older branches to allow extensions to rely on them
without branch-specific coding.

Avoid using potentially-under-aligned page buffers (Tom
Lane)

Invent new union types PGAlignedBlock and
PGAlignedXLogBlock, and use these in place of
plain char arrays, ensuring that the compiler can't place the
buffer at a misaligned start address. This fixes potential core
dumps on alignment-picky platforms, and may improve performance
even on platforms that allow misalignment.

Make src/port/snprintf.c follow the
C99 standard's definition of snprintf()'s result value (Tom Lane)

On platforms where this code is used (mostly Windows), its
pre-C99 behavior could lead to failure to detect buffer overrun, if
the calling code assumed C99 semantics.

When building on i386 with the clang compiler, require -msse2 to be used (Andres Freund)

This avoids problems with missed floating point overflow
checks.

Fix configure's detection of
the result type of strerror_r() (Tom
Lane)

The previous coding got the wrong answer when building with
icc on Linux (and perhaps in other
cases), leading to libpq not
returning useful error messages for system-reported errors.