Correctifs appliqués

Tom Lane pushed:

  • Doc: clarify wording about tool requirements in sourcerepo.sgml. Original wording had confusingly vague antecedent for "they", so replace that with a more repetitive but clearer formulation. In passing, make the link to the installation requirements section more specific. Per gripe from Martin Mai, though this is not the fix he initially proposed. Discussion:
  • Doc: desultory copy-editing for v10 release notes. Improve many item descriptions, improve markup, relocate some items that seemed to be in the wrong section.
  • Doc: remove claim that PROVE_FLAGS defaults to '--verbose'. Commit e9c81b601 changed this, but missed updating the documentation. The adjacent claim that we use TAP tests only in src/bin seems pretty obsolete as well. Minor other copy-editing.
  • On Windows, retry process creation if we fail to reserve shared memory. We've heard occasional reports of backend launch failing because pgwin32_ReserveSharedMemoryRegion() fails, indicating that something has already used that address space in the child process. It's not very clear what, given that we disable ASLR in Windows builds, but suspicion falls on antivirus products. It'd be better if we didn't have to disable ASLR, anyway. So let's try to ameliorate the problem by retrying the process launch after such a failure, up to 100 times. Patch by me, based on previous work by Amit Kapila and others. This is a longstanding issue, so back-patch to all supported branches. Discussion:
  • Stamp 10beta2.
  • Fix multiple assignments to a column of a domain type. We allow INSERT and UPDATE commands to assign to the same column more than once, as long as the assignments are to subfields or elements rather than the whole column. However, this failed when the target column was a domain over array rather than plain array. Fix by teaching process_matched_tle() to look through CoerceToDomain nodes, and add relevant test cases. Also add a group of test cases exercising domains over array of composite. It's doubtless accidental that CREATE DOMAIN allows this case while not allowing straight domain over composite; but it does, so we'd better make sure we don't break it. (I could not find any documentation mentioning either side of that, so no doc changes.) It's been like this for a long time, so back-patch to all supported branches. Discussion:
  • Avoid integer overflow while sifting-up a heap in tuplesort.c. If the number of tuples in the heap exceeds approximately INT_MAX/2, this loop's calculation "2*i+1" could overflow, resulting in a crash. Fix it by using unsigned int rather than int for the relevant local variables; that shouldn't cost anything extra on any popular hardware. Per bug #14722 from Sergey Koposov. Original patch by Sergey Koposov, modified by me per a suggestion from Heikki Linnakangas to use unsigned int not int64. Back-patch to 9.4, where tuplesort.c grew the ability to sort as many as INT_MAX tuples in-memory (commit 263865a48). Discussion:
  • Fix ruleutils.c for domain-over-array cases, too. Further investigation shows that ruleutils isn't quite up to speed either for cases where we have a domain-over-array: it needs to be prepared to look past a CoerceToDomain at the top level of field and element assignments, else it decompiles them incorrectly. Potentially this would result in failure to dump/reload a rule, if it looked like the one in the new test case. (I also added a test for EXPLAIN; that output isn't broken, but clearly we need more test coverage here.) Like commit b1cb32fb6, this bug is reachable in cases we already support, so back-patch all the way.
  • Fix dumping of FUNCTION RTEs that contain non-function-call expressions. The grammar will only accept something syntactically similar to a function call in a function-in-FROM expression. However, there are various ways to input something that ruleutils.c won't deparse that way, potentially leading to a view or rule that fails dump/reload. Fix by inserting a dummy CAST around anything that isn't going to deparse as a function (which is one of the ways to get something like that in there in the first place). In HEAD, also make use of the infrastructure added by this to avoid emitting unnecessary parentheses in CREATE INDEX deparsing. I did not change that in back branches, thinking that people might find it to be unexpected/unnecessary behavioral change. In HEAD, also fix incorrect logic for when to add extra parens to partition key expressions. Somebody apparently thought they could get away with simpler logic than pg_get_indexdef_worker has, but they were wrong --- a counterexample is PARTITION BY LIST ((a[1])). Ignoring the prettyprint flag for partition expressions isn't exactly a nice solution anyway. This has been broken all along, so back-patch to all supported branches. Discussion:
  • Fix broken link-command-line ordering for libpgfeutils. In the frontend Makefiles that pull in libpgfeutils, we'd generally done it like this: LDFLAGS += -L$(top_builddir)/src/fe_utils -lpgfeutils $(libpq_pgport) That method is badly broken, as seen in bug #14742 from Chris Ruprecht. The -L flag for src/fe_utils ends up being placed after whatever random -L flags are in LDFLAGS already. That puts us at risk of pulling in libpgfeutils.a from some previous installation rather than the freshly built one in src/fe_utils. Also, the lack of an "override" is hazardous if someone tries to specify some LDFLAGS on the make command line. The correct way to do it is like this: override LDFLAGS := -L$(top_builddir)/src/fe_utils -lpgfeutils $(libpq_pgport) $(LDFLAGS) so that libpgfeutils, along with libpq, libpgport, and libpgcommon, are guaranteed to be pulled in from the build tree and not from any referenced system directory, because their -L flags will appear first. In some places we'd been even lazier and done it like this: LDFLAGS += -L$(top_builddir)/src/fe_utils -lpgfeutils -lpq which is subtly wrong in an additional way: on platforms where we can't restrict the symbols exported by, it allows libpgfeutils to latch onto libpgport and libpgcommon symbols from, rather than directly from those static libraries as intended. This carries hazards like those explained in the comments for the libpq_pgport macro. In addition to fixing the broken libpgfeutils usages, I tried to standardize on using $(libpq_pgport) like so: override LDFLAGS := $(libpq_pgport) $(LDFLAGS) even where libpgfeutils is not in the picture. This makes no difference right now but will hopefully discourage future mistakes of the same ilk. And it's more like the way we handle CPPFLAGS in libpq-using Makefiles. In passing, just for consistency, make pgbench include PTHREAD_LIBS the same way everyplace else does, ie just after LIBS rather than in some random place in the command line. This might have practical effect if there are -L switches in that macro on some platform. It looks to me like the MSVC build scripts are not affected by this error, but someone more familiar with them than I might want to double check. Back-patch to 9.6 where libpgfeutils was introduced. In 9.6, the hazard this error creates is that a reinstallation might link to the prior installation's copy of libpgfeutils.a and thereby fail to absorb a minor-version bug fix. Discussion:
  • Code review for NextValueExpr expression node type. Add missing infrastructure for this node type, notably in ruleutils.c where its lack could demonstrably cause EXPLAIN to fail. Add outfuncs/readfuncs support. (outfuncs support is useful today for debugging purposes. The readfuncs support may never be needed, since at present it would only matter for parallel query and NextValueExpr should never appear in a parallelizable query; but it seems like a bad idea to have a primnode type that isn't fully supported here.) Teach planner infrastructure that NextValueExpr is a volatile, parallel-unsafe, non-leaky expression node with cost cpu_operator_cost. Given its limited scope of usage, there *might* be no live bug today from the lack of that knowledge, but it's certainly going to bite us on the rear someday. Teach pg_stat_statements about the new node type, too. While at it, also teach cost_qual_eval() that MinMaxExpr, SQLValueFunction, XmlExpr, and CoerceToDomain should be charged as cpu_operator_cost. Failing to do this for SQLValueFunction was an oversight in my commit 0bb51aa96. The others are longer-standing oversights, but no time like the present to fix them. (In principle, CoerceToDomain could have cost much higher than this, but it doesn't presently seem worth trying to examine the domain's constraints here.) Modify execExprInterp.c to execute NextValueExpr as an out-of-line function; it seems quite unlikely to me that it's worth insisting that it be inlined in all expression eval methods. Besides, providing the out-of-line function doesn't stop anyone from inlining if they want to. Adjust some places where NextValueExpr support had been inserted with the aid of a dartboard rather than keeping it in the same order as elsewhere. Discussion:
  • Improve comments for execExpr.c's isAssignmentIndirectionExpr(). I got confused about why this function doesn't need to recursively search the expression tree for a CaseTestExpr node. After figuring that out, add a comment to save the next person some time.
  • Improve comments for execExpr.c's handling of FieldStore subexpressions. Given this code's general eagerness to use subexpressions' output variables as temporary workspace, it's not exactly clear that it is safe for FieldStore to tell a newval subexpression that it can write into the same variable that is being supplied as a potential input. Document the chain of assumptions needed for that to be safe.

Andrew Gierth pushed:

Heikki Linnakangas pushed:

�lvaro Herrera pushed:

Andrew Dunstan pushed:

Correctifs en attente

Micha�l Paquier sent in another revision of a patch to fix an issue where pg_receivewal and messages were printed in non-verbose mode.

Mithun Cy sent in another revision of a patch to cache data in GetSnapshotData().

Thomas Munro sent in another revision of a patch to share record typmods among backends.

Ashutosh Bapat sent in another revision of a patch to skip partitions which can't be part of the path.

Amit Langote sent in a patch to properly set the ri_RangeTableIndex of partition result rels and correctly format the row shown in the WITH CHECK OPTION error message.

Alexander Korotkov sent in two revisions of a patch to double the shared memory allocation for SLRU LWLocks.

Ashutosh Bapat sent in two more revisions of a patch to enable partition-wise joins for declaratively partitioned tables.

Marina Polyakova sent in another revision of a patch to correct some pgbench serialization and deadlock errors.

Alik Khilazhev and Fabien COELHO traded patches to add a Zipfian distribution to pgbench.

Kyotaro HORIGUCHI and Amit Kapila traded patches to fix an issue where hash index on unlogged tables doesn't behave as expected.

Claudio Freire sent in three more revisions of a patch to enable VACUUM to use over 1GB of work_mem.

Masahiko Sawada sent in two more revisions of a patch to fix pg_stop_backup(wait_for_archive := true) on standby servers.

Amit Langote sent in another revision of a patch to cope with differing attnos in ATExecAttachPartition code and teach ATExecAttachPartition to skip validation in more cases.

Thomas Munro sent in a patch to tell DSA that atomic u64 is always available.

Amit Kapila sent in another revision of a patch to adjust the cost based on whether the below node is projection-capable.

Jeevan Ladhe sent in another revision of a patch to add support for default partitions in declaratively partitioned tables.

Mark Rofail sent in another revision of a patch to allow foreign keys to arrays using GIN indexes.

Masahiko Sawada sent in a patch to fix a typo in pg_upgrade/info.c.

Etsuro Fujita sent in a patch to fix a bug in ExecModifyTable() and some trigger issues for foreign tables.

Amit Khandekar sent in a patch to generate the result rels in canonical order.

Heikki Linnakangas sent in a patch to always use 2048 bit DH parameters for OpenSSL ephemeral DH ciphers.

Amit Langote sent in two revisions of a patch to update the description of \d[S+] that \? emits in psql.

Kyotaro HORIGUCHI sent in two revisions of a patch to ensure that PgFDW connection gets invalidated correctly by ALTER SERVER/ALTER USER MAPPING.

Ashutosh Bapat sent in a patch to replace lfirst() with lfirst_node() appropriately in planner.c.

�lvaro Herrera sent in a patch to fix some more race conditions in logical replication.

Thomas Munro sent in a patch to add more flexible LDAP auth search filters.

Thomas Munro sent in a patch to shore up inadequate infrastructure for NextValueExpr.

Ashutosh Sharma sent in a patch to fix an issue where PL/Perl didn't work on Windows.

Beena Emerson sent in another revision of a patch to implement default partitions for declarative partitions on RANGE.

Mithun Cy sent in another revision of a patch to implement auto_prewarm.

Haribabu Kommi sent in a patch to fix pg_basebackup Windows tar mode to stdout and replace setmode with _setmode function.

�lvaro Herrera sent in a patch to fix a bug in locking an update tuple chain.

Haribabu Kommi sent in a WIP patch to replace tuple with slot. This is infrastructure for pluggable storage engines.

Micha�l Paquier sent in a patch to add an -E (encoding) switch to pg_dumpall.

Julien Rouhaud sent in a patch to fix an issue which manifested as a segfault in HEAD when too many nested functions were called.