Correctifs appliqués

Tom Lane pushed:

  • Stabilize output of new regression test case. The test added by commit 390d58135 turns out to have different output in CLOBBER_CACHE_ALWAYS builds: there's an extra CONTEXT line in the error message as a result of detecting the error at a different place. Possibly we should do something to make that more consistent. But as a stopgap measure to make the buildfarm green again, adjust the test to suppress CONTEXT entirely. We can revert this if we do something in the backend to eliminate the inconsistency. Discussion: https://postgr.es/m/31545.1512924904@sss.pgh.pa.us https://git.postgresql.org/pg/commitdiff/9edc97b712e2f0ba041b40b4b2e2285d229f4fb0
  • Fix corner-case coredump in _SPI_error_callback(). I noticed that _SPI_execute_plan initially sets spierrcontext.arg = NULL, and only fills it in some time later. If an error were to happen in between, _SPI_error_callback would try to dereference the null pointer. This is unlikely --- there's not much between those points except push-snapshot calls --- but it's clearly not impossible. Tweak the callback to do nothing if the pointer isn't set yet. It's been like this for awhile, so back-patch to all supported branches. https://git.postgresql.org/pg/commitdiff/7eb16ab17d5c01b293aad35f0843e5f3a9a64080
  • Rethink MemoryContext creation to improve performance. This patch makes a number of interrelated changes to reduce the overhead involved in creating/deleting memory contexts. The key ideas are: * Include the AllocSetContext header of an aset.c context in its first malloc request, rather than allocating it separately in TopMemoryContext. This means that we now always create an initial or "keeper" block in an aset, even if it never receives any allocation requests. * Create freelists in which we can save and recycle recently-destroyed asets (this idea is due to Robert Haas). * In the common case where the name of a context is a constant string, just store a pointer to it in the context header, rather than copying the string. The first change eliminates a palloc/pfree cycle per context, and also avoids bloat in TopMemoryContext, at the price that creating a context now involves a malloc/free cycle even if the context never receives any allocations. That would be a loser for some common usage patterns, but recycling short-lived contexts via the freelist eliminates that pain. Avoiding copying constant strings not only saves strlen() and strcpy() overhead, but is an essential part of the freelist optimization because it makes the context header size constant. Currently we make no attempt to use the freelist for contexts with non-constant names. (Perhaps someday we'll need to think harder about that, but in current usage, most contexts with custom names are long-lived anyway.) The freelist management in this initial commit is pretty simplistic, and we might want to refine it later --- but in common workloads that will never matter because the freelists will never get full anyway. To create a context with a non-constant name, one is now required to call AllocSetContextCreateExtended and specify the MEMCONTEXT_COPY_NAME option. AllocSetContextCreate becomes a wrapper macro, and it includes a test that will complain about non-string-literal context name parameters on gcc and similar compilers. An unfortunate side effect of making AllocSetContextCreate a macro is that one is now *required* to use the size parameter abstraction macros (ALLOCSET_DEFAULT_SIZES and friends) with it; the pre-9.6 habit of writing out individual size parameters no longer works unless you switch to AllocSetContextCreateExtended. Internally to the memory-context-related modules, the context creation APIs are simplified, removing the rather baroque original design whereby a context-type module called mcxt.c which then called back into the context-type module. That saved a bit of code duplication, but not much, and it prevented context-type modules from exercising control over the allocation of context headers. In passing, I converted the test-and-elog validation of aset size parameters into Asserts to save a few more cycles. The original thought was that callers might compute size parameters on the fly, but in practice nobody does that, so it's useless to expend cycles on checking those numbers in production builds. Also, mark the memory context method-pointer structs "const", just for cleanliness. Discussion: https://postgr.es/m/2264.1512870796@sss.pgh.pa.us https://git.postgresql.org/pg/commitdiff/9fa6f00b1308dd10da4eca2f31ccbfc7b35bb461
  • Tighten configure's test for __builtin_constant_p(). Commit 9fa6f00b1 assumed that __builtin_constant_p("string literal") is TRUE, if the compiler has that function at all. Buildfarm results show that Sun Studio 12, at least, breaks that assumption. Removing that usage would leave us with no mechanical check for a very fragile coding requirement, so instead teach configure to ignore __builtin_constant_p() if it doesn't behave that way. We could complicate matters by distinguishing three cases (no such function, vs does, vs doesn't work for string literals); but for now, that seems unnecessary because our other existing uses of this function are just fairly minor optimizations of non-returning elog/ereport. We can live without that on the small population of compilers that act this way. Discussion: https://postgr.es/m/22997.1513264066@sss.pgh.pa.us https://git.postgresql.org/pg/commitdiff/9220b00e57352fda988b187940f5d5ac4851a8bb
  • Fix oversights in new plpgsql test suite infrastructure. Fix a couple of minor oversights in commit 632b03da3: the tests should be run in database "pl_regression" like the other PLs do, and we should clean up the tests' output cruft during "make clean". https://git.postgresql.org/pg/commitdiff/997071691f66dfe92e97e6b4e3d29d153317be31
  • Suppress compiler warning about no function return value. Compilers that don't know that ereport(ERROR) doesn't return complained about the new coding in scanint8() introduced by commit 101c7ee3e. Tweak coding to avoid the warning. Per buildfarm. https://git.postgresql.org/pg/commitdiff/b31a9d7dd3bf8435fddf404c4b75236d0ea76d78
  • Try harder to detect unavailability of __builtin_mul_overflow(int64). Commit c04d35f44 didn't quite do the job here, because it still allowed the compiler to deduce that the function call could be optimized away. Prevent that by putting the arguments and results in global variables. Discussion: https://postgr.es/m/20171213213754.pydkyjs6bt2hvsdb@alap3.anarazel.de https://git.postgresql.org/pg/commitdiff/c6d21d56f1a92b4762a22cbbb694b1e853165e70

Robert Haas pushed:

Peter Eisentraut pushed:

  • Fix comment. Reported-by: Noah Misch <noah@leadboat.com> https://git.postgresql.org/pg/commitdiff/4034db215b92c68ce55cf1c658d4ef7599ccc45a
  • PL/Python: Fix potential NULL pointer dereference. After d0aa965c0a0ac2ff7906ae1b1dad50a7952efa56, one error path in PLy_spi_execute_fetch_result() could result in the variable "result" being dereferenced after being set to NULL. Rearrange the code a bit to fix that. Also add another SPI_freetuptable() call so that that is cleared in all error paths. discovered by John Naylor <jcnaylor@gmail.com> via scan-build ideas and review by Tom Lane https://git.postgresql.org/pg/commitdiff/4c6744ed705df6f388371d044b87d1b4a60e9f80
  • Fix crash when using CALL on an aggregate. Author: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com> Reported-by: Rushabh Lathia <rushabh.lathia@gmail.com> https://git.postgresql.org/pg/commitdiff/3d8874224ff25de3ca4f9da8ce3118391bd6609e
  • Start a separate test suite for plpgsql. The plpgsql.sql test file in the main regression tests is now by far the largest after numeric_big, making editing and managing the test cases very cumbersome. The other PLs have their own test suites split up into smaller files by topic. It would be nice to have that for plpgsql as well. So, to get that started, set up test infrastructure in src/pl/plpgsql/src/ and split out the recently added procedure test cases into a new file there. That file now mirrors the test cases added to the other PLs, making managing those matching tests a bit easier too. msvc build system changes with help from Michael Paquier https://git.postgresql.org/pg/commitdiff/632b03da31cbbf4d32193d35031d301bd50d2679

Teodor Sigaev pushed:

Andres Freund pushed:

Andrew Dunstan pushed:

  • Fix walsender timeouts when decoding a large transaction. The logical slots have a fast code path for sending data so as not to impose too high a per message overhead. The fast path skips checks for interrupts and timeouts. However, the existing coding failed to consider the fact that a transaction with a large number of changes may take a very long time to be processed and sent to the client. This causes the walsender to ignore interrupts for potentially a long time and more importantly it will result in the walsender being killed due to timeout at the end of such a transaction. This commit changes the fast path to also check for interrupts and only allows calling the fast path when the last keepalive check happened less than half the walsender timeout ago. Otherwise the slower code path will be taken. Backpatched to 9.4 Petr Jelinek, reviewed by Kyotaro HORIGUCHI, Yura Sokolov, Craig Ringer and Robert Haas. Discussion: https://postgr.es/m/e082a56a-fd95-a250-3bae-0fff93832510@2ndquadrant.com https://git.postgresql.org/pg/commitdiff/0fedb4ea6946e72c5c51130446b59b083ba3dd21

Noah Misch pushed:

Correctifs en attente

Amit Langote sent in a patch to error out if the left hand side of ANY/ALL is not a scalar.

Etsuro Fujita sent in another revision of a patch to fix a bug in the PostgreSQL FDW.

Kyotaro HORIGUCHI sent in another revision of a patch to fix an issue with WAL.

Kyotaro HORIGUCHI sent in another revision of a patch to implement asynchronous execution infrastructure and use same in the PostgreSQL FDW.

Kyotaro HORIGUCHI sent in another revision of a patch to collect more stats about skipped vacuums.

Ashutosh Bapat sent in a patch to fix a comment in partition.c.

Alexander Korotkov sent in two more revisions of a patch to fix some infelicities in the the trigram supplied extension with respect to word similarity.

Amit Kapila and Robert Haas traded patches to fix parallel.c obliviousness about worker startup failures.

Masahiko Sawada and Fujii Masao traded patches to fix an assertion failure when the non-exclusive pg_stop_backup aborted.

Masahiko Sawada and Robert Haas traded patches to move relation extension locks out of heavyweight lock manager.

Haribabu Kommi sent in another revision of a patch to implement the infrastructure for pluggable storage.

Kyotaro HORIGUCHI sent in another revision of a patch to fix a race between SELECT and ALTER TABLE NO INHERIT.

Rushabh Lathia sent in another revision of a patch to implement parallel tuplesort for index creation.

Etsuro Fujita sent in another revision of a patch to implement tuple routing to foreign partitions.

Nikhil Sontakke sent in another revision of a patch to implement logical decoding of two-phase transactions.

Haribabu Kommi sent in another revision of a patch to implement pg_stat_walwrites.

Amit Langote sent in three revisions of a patch to allow boolean values in partition FOR VALUES clause.

Amit Langote sent in another revision of a patch to make partition pruning faster.

Thomas Munro sent in two more revisions of a patch to implement parallel hash.

David Steele sent in a patch to exclude unlogged tables from base backups.

Peter Eisentraut sent in two revisions of a patch to use portal pinning in PL/Perl and PL/PythonU.

Peter Eisentraut sent in another revision of a patch to replace GrantObjectType with ObjectType.

Beena Emerson and David Rowley traded patches to do runtime partition pruning.

Bill Moyers sent in a patch to fix a possible NULL dereference in str_time.

Haribabu Kommi sent in another revision of a patch to refactor handling of database attributes between pg_dump and pg_dumpall.

Amit Langote sent in a patch to emit list partition constraint as OR expression, making it round-trippable.

Andres Freund sent in a patch to remove out of date types.

John Naylor sent in two more revisions of a patch to make bootstrap data easier to use.

Ali Akbar sent in two revisions of a patch to add SET NOT NULL in inheritance children when needed.

Amit Khandekar sent in another revision of a patch to enable UPDATEs to partitioned keys which would have the effect of moving tuples to other partitions.

Fabien COELHO sent in another revision of a patch to add \if to pgbench.

Ali Akbar sent in two revisions of a patch to pg_upgrade to ensure that NOT NULL in inheritance children is consistent.

Micha�l Paquier sent in a patch to fix some infelicities in the overflow-safe integer math inline function on ARM.

Chapman Flack sent in a patch to give worker_spi.naptime an explicit time unit.

Konstantin Knizhnik sent in two more revisions of a patch to add a recheck_on_update property to indexes, signaling that they are non-injective.

Fabien COELHO sent in three more revisions of a patch to add more functions and operators to pgbench.

Amit Langote sent in a patch to teach dbsize.c functions about partitioned tables.

Chapman Flack sent in a patch to clarify that a BGW can register a dynamic BGW.

Kyotaro HORIGUCHI sent in a patch to fix a bug where autoprewarm is fogetting to register a tranche.

Maksim Milyutin sent in a patch to fix a wrong t_bits alignment in pageinspect.

Peter Geoghegan sent in a patch to promote "HOT parent tuple" elog to an ereport.

Christoph Berg sent in a patch to ensure that genbki.pl always produces reproducible output.

Christoph Berg sent in a patch to add support for VENDOR_VERSION to configure.

Thomas Munro sent in a patch to fix an infelicity between top-N sorts and parallel execution.

David Rowley sent in a patch to fix a typo in a comment in json_agg_transfn.

David Rowley sent in a patch to parallelize string_agg and array_agg.