Fix thinko in construction of old_conpfeqop list.
commit : f9208f2469635c372bf3c2ccfc9835dc11bd8c1c author : Tom Lane <email@example.com> date : Tue, 16 Jul 2019 18:17:47 -0400 committer: Tom Lane <firstname.lastname@example.org> date : Tue, 16 Jul 2019 18:17:47 -0400
This should lappend the OIDs, not lcons them; the existing code produced a list in reversed order. This is harmless for single-key FKs or FKs where all the key columns are of the same type, which probably explains how it went unnoticed. But if those conditions are not met, ATAddForeignKeyConstraint would make the wrong decision about whether an existing FK needs to be revalidated. I think it would almost always err in the safe direction by revalidating a constraint that didn't need it. You could imagine scenarios where the pfeqop check was fooled by swapping the types of two FK columns in one ALTER TABLE, but that case would probably be rejected by other tests, so it might be impossible to get to the worst-case scenario where an FK should be revalidated and isn't. (And even then, it's likely to be fine, unless there are weird inconsistencies in the equality behavior of the replacement types.) However, this is a performance bug at least. Noted while poking around to see whether lcons calls could be converted to lappend. This bug is old, dating to commit cb3a7c2b9, so back-patch to all supported branches.
doc: mention pg_reload_conf() for reloading the config file
commit : 1944a253b3aeaaeb204cbaa66f84237a81f87151 author : Bruce Momjian <email@example.com> date : Mon, 15 Jul 2019 20:57:24 -0400 committer: Bruce Momjian <firstname.lastname@example.org> date : Mon, 15 Jul 2019 20:57:24 -0400
Reported-by: Ian Barwick Discussion: https://email@example.com Backpatch-through: 9.4
Fix variable initialization when using buffering build with GiST
commit : b9e1538fcf35708f19ce3f86c22b9bd91a0d2820 author : Michael Paquier <firstname.lastname@example.org> date : Wed, 10 Jul 2019 15:15:23 +0900 committer: Michael Paquier <email@example.com> date : Wed, 10 Jul 2019 15:15:23 +0900
This can cause valgrind to complain, as the flag marking a buffer as a temporary copy was not getting initialized. While on it, fill in with zeros newly-created buffer pages. This does not matter when loading a block from a temporary file, but it makes the push of an index tuple into a new buffer page safer. This has been introduced by 1d27dcf, so backpatch all the way down to 9.4. Author: Alexander Lakhin Discussion: https://firstname.lastname@example.org Backpatch-through: 9.4
Add support for Visual Studio 2019 in build scripts
commit : 3337fd192596973936c1cd96294f21f3c6f6e6c7 author : Michael Paquier <email@example.com> date : Wed, 3 Jul 2019 08:58:28 +0900 committer: Michael Paquier <firstname.lastname@example.org> date : Wed, 3 Jul 2019 08:58:28 +0900
This adjusts the documentation and the scripts related to the versions of Windows SDK supported. Author: Haribabu Kommi Reviewed-by: Andrew Dunstan, Juan José Santamaría Flecha, Michael Paquier Discussion: https://postgr.es/m/CAJrrPGcfqXhfPyMrny9apoDU7M1t59dzVAvoJ9AeAh5BJi+UzA@mail.gmail.com Backpatch-through: 9.4
Don't read fields of a misaligned ExpandedObjectHeader or AnyArrayType.
commit : b664b187d7ea6546ef4e0f32167a93c6a74dca08 author : Noah Misch <email@example.com> date : Sun, 30 Jun 2019 17:34:17 -0700 committer: Noah Misch <firstname.lastname@example.org> date : Sun, 30 Jun 2019 17:34:17 -0700
UBSan complains about this. Instead, cast to a suitable type requiring only 4-byte alignment. DatumGetAnyArrayP() already assumes one can cast between AnyArrayType and ArrayType, so this doesn't introduce a new assumption. Back-patch to 9.5, where AnyArrayType was introduced. Reviewed by Tom Lane. Discussion: https://postgr.es/m/20190629210334.GA1244217@rfd.leadboat.com
Repair logic for reordering grouping sets optimization.
commit : 4a36c77156f2ff6e07a349cddc65e5dd21abc1a8 author : Andrew Gierth <email@example.com> date : Sun, 30 Jun 2019 23:49:31 +0100 committer: Andrew Gierth <firstname.lastname@example.org> date : Sun, 30 Jun 2019 23:49:31 +0100
The logic in reorder_grouping_sets to order grouping set elements to match a pre-specified sort ordering was defective, resulting in unnecessary sort nodes (though the query output would still be correct). Repair, simplifying the code a little, and add a test. Per report from Richard Guo, though I didn't use their patch. Original bug seems to have been my fault. Backpatch back to 9.5 where grouping sets were introduced. Discussion: https://postgr.es/m/CAN_9JTzyjGcUjiBHxLsgqfk7PkdLGXiM=pwM+=ph2LsWw0WO1A@mail.gmail.com
Fix misleading comment in nodeIndexonlyscan.c.
commit : d7395cf608e7ec8c9cebd17c19dc5d07c761010e author : Thomas Munro <email@example.com> date : Fri, 28 Jun 2019 11:11:26 +1200 committer: Thomas Munro <firstname.lastname@example.org> date : Fri, 28 Jun 2019 11:11:26 +1200
The stated reason for acquiring predicate locks on heap pages hasn't existed since commit c01262a8, so fix the comment. Perhaps in a later release we'll also be able to change the code to use tuple locks. Back-patch all the way. Reviewed-by: Ashwin Agrawal Discussion: https://postgr.es/m/CAEepm%3D2GK3FVdnt5V3d%2Bh9njWipCv_fNL%3DwjxyUhzsF%3D0PcbNg%40mail.gmail.com
Update reference to sampling algorithm in analyze.c
commit : 88d63c6ac78de0a9c8bffc43146666e630efc426 author : Tomas Vondra <email@example.com> date : Thu, 27 Jun 2019 18:14:25 +0200 committer: Tomas Vondra <firstname.lastname@example.org> date : Thu, 27 Jun 2019 18:14:25 +0200
Commit 83e176ec1 moved row sampling functions from analyze.c to utils/misc/sampling.c, but failed to update comment referring to the sampling algorithm from Jeff Vitter's paper. Correct the comment by pointing to utils/misc/sampling.c. Author: Etsuro Fujita Discussion: https://postgr.es/m/CAPmGK154gp%2BQd%3DcorQOv%2BPmbyVyZBjp_%2Bhb766UJeD1e_ie6XQ%40mail.gmail.com
Add support for OpenSSL 1.1.0 and newer versions in MSVC scripts
commit : d908a0087e0a74c16cf5869276f7cce165bf0782 author : Michael Paquier <email@example.com> date : Wed, 26 Jun 2019 23:05:54 +0900 committer: Michael Paquier <firstname.lastname@example.org> date : Wed, 26 Jun 2019 23:05:54 +0900
Up to now, the MSVC build scripts are able to support only one fixed version of OpenSSL, and they lacked logic to detect the version of OpenSSL a given compilation of Postgres is linking to (currently 1.0.2, the latest LTS of upstream which will be EOL'd at the end of 2019). This commit adds more logic to detect the version of OpenSSL used by a build and makes use of it to add support for compilation with OpenSSL 1.1.0 which requires a new set of compilation flags to work properly. The supported OpenSSL installers have changed their library layer with various library renames with the upgrade to 1.1.0, making the logic a bit more complicated. The scripts are now able to adapt to the new world order. Reported-by: Sergey Pashkov Author: Juan José Santamaría Flecha, Michael Paquier Reviewed-by: Álvaro Herrera Discussion: https://email@example.com Backpatch-through: 9.4
Don't unset MAKEFLAGS in non-GNU Makefile.
commit : 9ad5ea82d2bda2ae04b1be958d890d24bc1010f6 author : Thomas Munro <firstname.lastname@example.org> date : Tue, 25 Jun 2019 09:29:53 +1200 committer: Thomas Munro <email@example.com> date : Tue, 25 Jun 2019 09:29:53 +1200
It's useful to be able to pass down options like -s and -j. Back-patch to 9.5, like commit a76200de. Discussion: https://postgr.es/m/CA%2BhUKG%2Be1M8-BbL%3DPqhTp6oO6XPO6%2Bs9WGQMLfbuZ%3DG9CtzyXg%40mail.gmail.com
Further fix ALTER COLUMN TYPE's handling of indexes and index constraints.
commit : 316f6893282450b5a748550d922aa72141f97d1c author : Tom Lane <firstname.lastname@example.org> date : Mon, 24 Jun 2019 16:43:05 -0400 committer: Tom Lane <email@example.com> date : Mon, 24 Jun 2019 16:43:05 -0400
This patch reverts all the code changes of commit e76de8861, which turns out to have been seriously misguided. We can't wait till later to compute the definition string for an index; we must capture that before applying the data type change for any column it depends on, else ruleutils.c will deliverr wrong/misleading results. (This fine point was documented nowhere, of course.) I'd also managed to forget that ATExecAlterColumnType executes once per ALTER COLUMN TYPE clause, not once per statement; which resulted in the code being basically completely broken for any case in which multiple ALTER COLUMN TYPE clauses are applied to a table having non-constraint indexes that must be rebuilt. Through very bad luck, none of the existing test cases nor the ones added by e76de8861 caught that, but of course it was soon found in the field. The previous patch also had an implicit assumption that if a constraint's index had a dependency on a table column, so would the constraint --- but that isn't actually true, so it didn't fix such cases. Instead of trying to delete unneeded index dependencies later, do the is-there-a-constraint lookup immediately on seeing an index dependency, and switch to remembering the constraint if so. In the unusual case of multiple column dependencies for a constraint index, this will result in duplicate constraint lookups, but that's not that horrible compared to all the other work that happens here. Besides, such cases did not work at all before, so it's hard to argue that they're performance-critical for anyone. Per bug #15865 from Keith Fiske. As before, back-patch to all supported branches. Discussion: https://firstname.lastname@example.org
Fix spinlock assembly code for MIPS so it works on MIPS r6.
commit : 36d2c3ad33f8af9415e41b12822516a3e1e68486 author : Tom Lane <email@example.com> date : Sat, 22 Jun 2019 20:31:50 -0400 committer: Tom Lane <firstname.lastname@example.org> date : Sat, 22 Jun 2019 20:31:50 -0400
Original MIPS-I processors didn't have the LL/SC instructions (nor any other userland synchronization primitive). If the build toolchain targets that ISA variant by default, as an astonishingly large fraction of MIPS platforms still do, the assembler won't take LL/SC without coercion in the form of a ".set mips2" instruction. But we issued that unconditionally, making it an ISA downgrade for chips later than MIPS2. That breaks things for the latest MIPS r6 ISA, which encodes these instructions differently. Adjust the code so we don't change ISA level if it's >= 2. Note that this patch doesn't change what happens on an actual MIPS-I processor: either the kernel will emulate these instructions transparently, or you'll get a SIGILL failure. That tradeoff seemed fine in 2002 when this code was added (cf 3cbe6b247), and it's even more so today when MIPS-I is basically extinct. But let's add a comment about that. YunQiang Su (with cosmetic adjustments by me). Back-patch to all supported branches. Discussion: https://email@example.com
Remove obsolete comments about sempahores from proc.c.
commit : cb9242efe0abd8ed9129c16e91085a1675e72f30 author : Thomas Munro <firstname.lastname@example.org> date : Fri, 21 Jun 2019 10:57:07 +1200 committer: Thomas Munro <email@example.com> date : Fri, 21 Jun 2019 10:57:07 +1200
Commit 6753333f switched from a semaphore-based wait to a latch-based wait for ProcSleep()/ProcWakeup(), but left behind some stray references to semaphores. Back-patch to 9.5. Reviewed-by: Daniel Gustafsson, Michael Paquier Discussion: https://postgr.es/m/CA+hUKGLs5H6zhmgTijZ1OaJvC1sG0=AFXc1aHuce32tKiQrdEA@mail.gmail.com