1. 11 Mar, 2019 16 commits
    • Tom Lane's avatar
      Allow fractional input values for integer GUCs, and improve rounding logic. · 1a83a80a
      Tom Lane authored
      Historically guc.c has just refused examples like set work_mem = '30.1GB',
      but it seems more useful for it to take that and round off the value to
      some reasonable approximation of what the user said.  Just rounding to
      the parameter's native unit would work, but it would lead to rather
      silly-looking settings, such as 31562138kB for this example.  Instead
      let's round to the nearest multiple of the next smaller unit (if any),
      producing 30822MB.
      
      Also, do the units conversion math in floating point and round to integer
      (if needed) only at the end.  This produces saner results for inputs that
      aren't exact multiples of the parameter's native unit, and removes another
      difference in the behavior for integer vs. float parameters.
      
      In passing, document the ability to use hex or octal input where it
      ought to be documented.
      
      Discussion: https://postgr.es/m/1798.1552165479@sss.pgh.pa.us
      1a83a80a
    • Andrew Dunstan's avatar
      Tweak wording on VARIADIC array doc patch. · fe0b2c12
      Andrew Dunstan authored
      Per suggestion from Tom Lane.
      fe0b2c12
    • Andrew Dunstan's avatar
      Document incompatibility of comparison expressions with VARIADIC array arguments · 5e74a427
      Andrew Dunstan authored
      COALESCE, GREATEST and LEAST all look like functions taking variable
      numbers of arguments, but in fact they are not functions, and so
      VARIADIC array arguments don't work with them. Add a note to the docs
      explaining this fact.
      
      The consensus is not to try to make this work, but just to document the
      limitation.
      
      Discussion: https://postgr.es/m/CAFj8pRCaAtuXuRtvXf5GmPbAVriUQrNMo7-=TXUFN025S31R_w@mail.gmail.com
      5e74a427
    • Andres Freund's avatar
      Remove spurious return. · 32b8f0b0
      Andres Freund authored
      Per buildfarm member anole.
      
      Author: Andres Freund
      32b8f0b0
    • Tom Lane's avatar
      Give up on testing guc.c's behavior for "infinity" inputs. · d9c5e962
      Tom Lane authored
      Further buildfarm testing shows that on the machines that are failing
      ac75959c's test case, what we're actually getting from strtod("-infinity")
      is a syntax error (endptr == value) not ERANGE at all.  This test case
      is not worth carrying two sets of expected output for, so just remove it,
      and revert commit b212245f's misguided attempt to work around the platform
      dependency.
      
      Discussion: https://postgr.es/m/E1h33xk-0001Og-Gs@gemulon.postgresql.org
      d9c5e962
    • Andres Freund's avatar
      Ensure sufficient alignment for ParallelTableScanDescData in BTShared. · 8cacea7a
      Andres Freund authored
      Previously ParallelTableScanDescData was just a member in BTShared,
      but after c2fe139c that doesn't guarantee sufficient alignment as
      specific AMs might (are likely to) need atomic variables in the
      struct.
      
      One might think that MAXALIGNing would be sufficient, but as a
      comment in shm_toc_allocate() explains, that's not enough. For now,
      copy the hack described there.
      
      For parallel sequential scans no such change is needed, as its
      allocations go through shm_toc_allocate().
      
      An alternative approach would have been to allocate the parallel scan
      descriptor in a separate TOC entry, but there seems little benefit in
      doing so.
      
      Per buildfarm member dromedary.
      
      Author: Andres Freund
      Discussion: https://postgr.es/m/20190311203126.ty5gbfz42gjbm6i6@alap3.anarazel.de
      8cacea7a
    • Andres Freund's avatar
      tableam: Add and use scan APIs. · c2fe139c
      Andres Freund authored
      Too allow table accesses to be not directly dependent on heap, several
      new abstractions are needed. Specifically:
      
      1) Heap scans need to be generalized into table scans. Do this by
         introducing TableScanDesc, which will be the "base class" for
         individual AMs. This contains the AM independent fields from
         HeapScanDesc.
      
         The previous heap_{beginscan,rescan,endscan} et al. have been
         replaced with a table_ version.
      
         There's no direct replacement for heap_getnext(), as that returned
         a HeapTuple, which is undesirable for a other AMs. Instead there's
         table_scan_getnextslot().  But note that heap_getnext() lives on,
         it's still used widely to access catalog tables.
      
         This is achieved by new scan_begin, scan_end, scan_rescan,
         scan_getnextslot callbacks.
      
      2) The portion of parallel scans that's shared between backends need
         to be able to do so without the user doing per-AM work. To achieve
         that new parallelscan_{estimate, initialize, reinitialize}
         callbacks are introduced, which operate on a new
         ParallelTableScanDesc, which again can be subclassed by AMs.
      
         As it is likely that several AMs are going to be block oriented,
         block oriented callbacks that can be shared between such AMs are
         provided and used by heap. table_block_parallelscan_{estimate,
         intiialize, reinitialize} as callbacks, and
         table_block_parallelscan_{nextpage, init} for use in AMs. These
         operate on a ParallelBlockTableScanDesc.
      
      3) Index scans need to be able to access tables to return a tuple, and
         there needs to be state across individual accesses to the heap to
         store state like buffers. That's now handled by introducing a
         sort-of-scan IndexFetchTable, which again is intended to be
         subclassed by individual AMs (for heap IndexFetchHeap).
      
         The relevant callbacks for an AM are index_fetch_{end, begin,
         reset} to create the necessary state, and index_fetch_tuple to
         retrieve an indexed tuple.  Note that index_fetch_tuple
         implementations need to be smarter than just blindly fetching the
         tuples for AMs that have optimizations similar to heap's HOT - the
         currently alive tuple in the update chain needs to be fetched if
         appropriate.
      
         Similar to table_scan_getnextslot(), it's undesirable to continue
         to return HeapTuples. Thus index_fetch_heap (might want to rename
         that later) now accepts a slot as an argument. Core code doesn't
         have a lot of call sites performing index scans without going
         through the systable_* API (in contrast to loads of heap_getnext
         calls and working directly with HeapTuples).
      
         Index scans now store the result of a search in
         IndexScanDesc->xs_heaptid, rather than xs_ctup->t_self. As the
         target is not generally a HeapTuple anymore that seems cleaner.
      
      To be able to sensible adapt code to use the above, two further
      callbacks have been introduced:
      
      a) slot_callbacks returns a TupleTableSlotOps* suitable for creating
         slots capable of holding a tuple of the AMs
         type. table_slot_callbacks() and table_slot_create() are based
         upon that, but have additional logic to deal with views, foreign
         tables, etc.
      
         While this change could have been done separately, nearly all the
         call sites that needed to be adapted for the rest of this commit
         also would have been needed to be adapted for
         table_slot_callbacks(), making separation not worthwhile.
      
      b) tuple_satisfies_snapshot checks whether the tuple in a slot is
         currently visible according to a snapshot. That's required as a few
         places now don't have a buffer + HeapTuple around, but a
         slot (which in heap's case internally has that information).
      
      Additionally a few infrastructure changes were needed:
      
      I) SysScanDesc, as used by systable_{beginscan, getnext} et al. now
         internally uses a slot to keep track of tuples. While
         systable_getnext() still returns HeapTuples, and will so for the
         foreseeable future, the index API (see 1) above) now only deals with
         slots.
      
      The remainder, and largest part, of this commit is then adjusting all
      scans in postgres to use the new APIs.
      
      Author: Andres Freund, Haribabu Kommi, Alvaro Herrera
      Discussion:
          https://postgr.es/m/20180703070645.wchpu5muyto5n647@alap3.anarazel.de
          https://postgr.es/m/20160812231527.GA690404@alvherre.pgsql
      c2fe139c
    • Andrew Dunstan's avatar
      pgbench: increase the maximum number of variables/arguments · a4784152
      Andrew Dunstan authored
      pgbench's arbitrary limit of 10 arguments for SQL statements or
      metacommands is far too low. Increase it to 256.
      
      This results in a very modest increase in memory usage, not enough to
      worry about.
      
      The maximum includes the SQL statement or metacommand. This is reflected
      in the comments and revised TAP tests.
      
      Simon Riggs and Dagfinn Ilmari Mannsåker with some light editing by me.
      Reviewed by: David Rowley and Fabien Coelho
      
      Discussion: https://postgr.es/m/CANP8+jJiMJOAf-dLoHuR-8GENiK+eHTY=Omw38Qx7j2g0NDTXA@mail.gmail.com
      a4784152
    • Amit Kapila's avatar
    • Alvaro Herrera's avatar
      Move hash_any prototype from access/hash.h to utils/hashutils.h · af38498d
      Alvaro Herrera authored
      ... as well as its implementation from backend/access/hash/hashfunc.c to
      backend/utils/hash/hashfn.c.
      
      access/hash is the place for the hash index AM, not really appropriate
      for generic facilities, which is what hash_any is; having things the old
      way meant that anything using hash_any had to include the AM's include
      file, pointlessly polluting its namespace with unrelated, unnecessary
      cruft.
      
      Also move the HTEqual strategy number to access/stratnum.h from
      access/hash.h.
      
      To avoid breaking third-party extension code, add an #include
      "utils/hashutils.h" to access/hash.h.  (An easily removed line by
      committers who enjoy their asbestos suits to protect them from angry
      extension authors.)
      
      Discussion: https://postgr.es/m/201901251935.ser5e4h6djt2@alvherre.pgsql
      af38498d
    • Tom Lane's avatar
      In guc.c, ignore ERANGE errors from strtod(). · b212245f
      Tom Lane authored
      Instead, just proceed with the infinity or zero result that it should
      return for overflow/underflow.  This avoids a platform dependency,
      in that various versions of strtod are inconsistent about whether they
      signal ERANGE for a value that's specified as infinity.
      
      It's possible this won't be enough to remove the buildfarm failures
      we're seeing from ac75959c, in which case I'll take out the infinity
      test case that commit added.  But first let's see if we can fix it.
      
      Discussion: https://postgr.es/m/E1h33xk-0001Og-Gs@gemulon.postgresql.org
      b212245f
    • Michael Meskes's avatar
      Fix potential memory access violation in ecpg if filename of include file is · 08cecfaf
      Michael Meskes authored
      shorter than 2 characters.
      
      Patch by: "Wu, Fei" <wufei.fnst@cn.fujitsu.com>
      08cecfaf
    • Michael Meskes's avatar
      Fix ecpglib regression that made it impossible to close a cursor that was · 98bdaab0
      Michael Meskes authored
      opened in a prepared statement.
      
      Patch by: "Kuroda, Hayato" <kuroda.hayato@jp.fujitsu.com>
      98bdaab0
    • Peter Eisentraut's avatar
      Remove unused macro · 3c067154
      Peter Eisentraut authored
      Use was removed in 25ca5a9a.
      3c067154
    • Peter Eisentraut's avatar
      psql: Add documentation URL to \help output · 27f3dea6
      Peter Eisentraut authored
      Add a link to the specific command's reference web page to the bottom
      of its \help output.
      
      Discussion: https://www.postgresql.org/message-id/flat/40179bd0-fa7d-4108-1991-a20ae9ad5667%402ndquadrant.com
      27f3dea6
    • Michael Paquier's avatar
      Adjust error message for partial writes in WAL segments · f2d84a4a
      Michael Paquier authored
      93473c6a has removed openLogOff, changing on the way the error message
      which is used to report partial writes to WAL segments.  The
      newly-introduced error message used the offset up to which the write has
      happened, keeping always the same total length to write.  This changes
      the error message so as the number of bytes left to write are reported.
      
      Reported-by: Michael Paquier
      Author: Robert Haas
      Discussion: https://postgr.es/m/20190306235251.GA17293@paquier.xyz
      f2d84a4a
  2. 10 Mar, 2019 8 commits
    • Alvaro Herrera's avatar
      Fix documentation on partitioning vs. foreign tables · fc84c05a
      Alvaro Herrera authored
      1. The PARTITION OF clause of CREATE FOREIGN TABLE was not explained in
         the CREATE FOREIGN TABLE reference page.  Add it.
         (Postgres 10 onwards)
      
      2. The limitation that tuple routing cannot target partitions that are
         foreign tables was not documented clearly enough.  Improve wording.
         (Postgres 10 onwards)
      
      3. The UPDATE tuple re-routing concurrency behavior was explained in
         the DDL chapter, which doesn't seem the right place.  Move it to the
         UPDATE reference page instead.  (Postgres 11 onwards).
      
      Authors: Amit Langote, David Rowley.
      Reviewed-by: Etsuro Fujita.
      Reported-by: Derek Hans
      Discussion: https://postgr.es/m/CAGrP7a3Xc1Qy_B2WJcgAD8uQTS_NDcJn06O5mtS_Ne1nYhBsyw@mail.gmail.com
      fc84c05a
    • Tom Lane's avatar
      Reduce the default value of autovacuum_vacuum_cost_delay to 2ms. · cbccac37
      Tom Lane authored
      This is a better way to implement the desired change of increasing
      autovacuum's default resource consumption.
      
      Discussion: https://postgr.es/m/28720.1552101086@sss.pgh.pa.us
      cbccac37
    • Tom Lane's avatar
      Revert "Increase the default vacuum_cost_limit from 200 to 2000" · 52985e4f
      Tom Lane authored
      This reverts commit bd09503e.
      
      Per discussion, it seems like what we should do instead is to
      reduce the default value of autovacuum_vacuum_cost_delay by the
      same factor.  That's functionally equivalent as long as the
      platform can accurately service the smaller delay request, which
      should be true on anything released in the last 10 years or more.
      And smaller, more-closely-spaced delays are better in terms of
      providing a steady I/O load.
      
      Discussion: https://postgr.es/m/28720.1552101086@sss.pgh.pa.us
      52985e4f
    • Tom Lane's avatar
      Convert [autovacuum_]vacuum_cost_delay into floating-point GUCs. · caf626b2
      Tom Lane authored
      This change makes it possible to specify sub-millisecond delays,
      which work well on most modern platforms, though that was not true
      when the cost-delay feature was designed.
      
      To support this without breaking existing configuration entries,
      improve guc.c to allow floating-point GUCs to have units.  Also,
      allow "us" (microseconds) as an input/output unit for time-unit GUCs.
      (It's not allowed as a base unit, at least not yet.)
      
      Likewise change the autovacuum_vacuum_cost_delay reloption to be
      floating-point; this forces a catversion bump because the layout of
      StdRdOptions changes.
      
      This patch doesn't in itself change the default values or allowed
      ranges for these parameters, and it should not affect the behavior
      for any already-allowed setting for them.
      
      Discussion: https://postgr.es/m/1798.1552165479@sss.pgh.pa.us
      caf626b2
    • Tom Lane's avatar
      Include GUC's unit, if it has one, in out-of-range error messages. · 28a65fc3
      Tom Lane authored
      This should reduce confusion in cases where we've applied a units
      conversion, so that the number being reported (and the quoted range
      limits) are in some other units than what the user gave in the
      setting we're rejecting.
      
      Some of the changes here assume that float GUCs can have units,
      which isn't true just yet, but will be shortly.
      
      Discussion: https://postgr.es/m/3811.1552169665@sss.pgh.pa.us
      28a65fc3
    • Tom Lane's avatar
      Disallow NaN as a value for floating-point GUCs. · ac75959c
      Tom Lane authored
      None of the code that uses GUC values is really prepared for them to
      hold NaN, but parse_real() didn't have any defense against accepting
      such a value.  Treat it the same as a syntax error.
      
      I haven't attempted to analyze the exact consequences of setting any
      of the float GUCs to NaN, but since they're quite unlikely to be good,
      this seems like a back-patchable bug fix.
      
      Note: we don't need an explicit test for +-Infinity because those will
      be rejected by existing range checks.  I added a regression test for
      that in HEAD, but not older branches because the spelling of the value
      in the error message will be platform-dependent in branches where we
      don't always use port/snprintf.c.
      
      Discussion: https://postgr.es/m/1798.1552165479@sss.pgh.pa.us
      ac75959c
    • Alvaro Herrera's avatar
      pg_upgrade: Ignore TOAST for partitioned tables · 203749a8
      Alvaro Herrera authored
      Since partitioned tables in pg12 do not have toast tables, trying to set
      the toast OID confuses pg_upgrade.  Have pg_dump omit those values to
      avoid the problem.
      
      Per Andres Freund and buildfarm members crake and snapper
      Discussion: https://postgr.es/m/20190306204104.yle5jfbnqkcwykni@alap3.anarazel.de
      203749a8
    • Alexander Korotkov's avatar
      Support for INCLUDE attributes in GiST indexes · f2e40380
      Alexander Korotkov authored
      Similarly to B-tree, GiST index access method gets support of INCLUDE
      attributes.  These attributes aren't used for tree navigation and aren't
      present in non-leaf pages.  But they are present in leaf pages and can be
      fetched during index-only scan.
      
      The point of having INCLUDE attributes in GiST indexes is slightly different
      from the point of having them in B-tree.  The main point of INCLUDE attributes
      in B-tree is to define UNIQUE constraint over part of attributes enabled for
      index-only scan.  In GiST the main point of INCLUDE attributes is to use
      index-only scan for attributes, whose data types don't have GiST opclasses.
      
      Discussion: https://postgr.es/m/73A1A452-AD5F-40D4-BD61-978622FF75C1%40yandex-team.ru
      Author: Andrey Borodin, with small changes by me
      Reviewed-by: Andreas Karlsson
      f2e40380
  3. 09 Mar, 2019 4 commits
  4. 08 Mar, 2019 6 commits
  5. 07 Mar, 2019 6 commits
    • Alvaro Herrera's avatar
      Fix minor deficiencies in XMLTABLE, xpath(), xmlexists() · 251cf2e2
      Alvaro Herrera authored
      Correctly process nodes of more types than previously.  In some cases,
      nodes were being ignored (nothing was output); in other cases, trying to
      return them resulted in errors about unrecognized nodes.  In yet other
      cases, necessary escaping (of XML special characters) was not being
      done.  Fix all those (as far as the authors could find) and add
      regression tests cases verifying the new behavior.
      
      I (Álvaro) was of two minds about backpatching these changes.  They do
      seem bugfixes that would benefit most users of the affected functions;
      but on the other hand it would change established behavior in minor
      releases, so it seems prudent not to.
      
      Authors: Pavel Stehule, Markus Winand, Chapman Flack
      Discussion:
         https://postgr.es/m/CAFj8pRA6J25CtAZ2TuRvxK3gat7-bBUYh0rfE2yM7Hj9GD14Dg@mail.gmail.com
         https://postgr.es/m/8BDB0627-2105-4564-AA76-7849F028B96E@winand.at
      
      The elephant in the room as pointed out by Chapman Flack, not fixed in
      this commit, is that we still have XMLTABLE operating on XPath 1.0
      instead of the standard-mandated XQuery (or even its subset XPath 2.0).
      Fixing that is a major undertaking, however.
      251cf2e2
    • Tom Lane's avatar
      Fix handling of targetlist SRFs when scan/join relation is known empty. · 1d338584
      Tom Lane authored
      When we introduced separate ProjectSetPath nodes for application of
      set-returning functions in v10, we inadvertently broke some cases where
      we're supposed to recognize that the result of a subquery is known to be
      empty (contain zero rows).  That's because IS_DUMMY_REL was just looking
      for a childless AppendPath without allowing for a ProjectSetPath being
      possibly stuck on top.  In itself, this didn't do anything much worse
      than produce slightly worse plans for some corner cases.
      
      Then in v11, commit 11cf92f6 rearranged things to allow the scan/join
      targetlist to be applied directly to partial paths before they get
      gathered.  But it inserted a short-circuit path for dummy relations
      that was a little too short: it failed to insert a ProjectSetPath node
      at all for a targetlist containing set-returning functions, resulting in
      bogus "set-valued function called in context that cannot accept a set"
      errors, as reported in bug #15669 from Madelaine Thibaut.
      
      The best way to fix this mess seems to be to reimplement IS_DUMMY_REL
      so that it drills down through any ProjectSetPath nodes that might be
      there (and it seems like we'd better allow for ProjectionPath as well).
      
      While we're at it, make it look at rel->pathlist not cheapest_total_path,
      so that it gives the right answer independently of whether set_cheapest
      has been done lately.  That dependency looks pretty shaky in the context
      of code like apply_scanjoin_target_to_paths, and even if it's not broken
      today it'd certainly bite us at some point.  (Nastily, unsafe use of the
      old coding would almost always work; the hazard comes down to possibly
      looking through a dangling pointer, and only once in a blue moon would
      you find something there that resulted in the wrong answer.)
      
      It now looks like it was a mistake for IS_DUMMY_REL to be a macro: if
      there are any extensions using it, they'll continue to use the old
      inadequate logic until they're recompiled, after which they'll fail
      to load into server versions predating this fix.  Hopefully there are
      few such extensions.
      
      Having fixed IS_DUMMY_REL, the special path for dummy rels in
      apply_scanjoin_target_to_paths is unnecessary as well as being wrong,
      so we can just drop it.
      
      Also change a few places that were testing for partitioned-ness of a
      planner relation but not using IS_PARTITIONED_REL for the purpose; that
      seems unsafe as well as inconsistent, plus it required an ugly hack in
      apply_scanjoin_target_to_paths.
      
      In passing, save a few cycles in apply_scanjoin_target_to_paths by
      skipping processing of pre-existing paths for partitioned rels,
      and do some cosmetic cleanup and comment adjustment in that function.
      
      I renamed IS_DUMMY_PATH to IS_DUMMY_APPEND with the intention of breaking
      any code that might be using it, since in almost every case that would
      be wrong; IS_DUMMY_REL is what to be using instead.
      
      In HEAD, also make set_dummy_rel_pathlist static (since it's no longer
      used from outside allpaths.c), and delete is_dummy_plan, since it's no
      longer used anywhere.
      
      Back-patch as appropriate into v11 and v10.
      
      Tom Lane and Julien Rouhaud
      
      Discussion: https://postgr.es/m/15669-02fb3296cca26203@postgresql.org
      1d338584
    • Robert Haas's avatar
      Allow ATTACH PARTITION with only ShareUpdateExclusiveLock. · 898e5e32
      Robert Haas authored
      We still require AccessExclusiveLock on the partition itself, because
      otherwise an insert that violates the newly-imposed partition
      constraint could be in progress at the same time that we're changing
      that constraint; only the lock level on the parent relation is
      weakened.
      
      To make this safe, we have to cope with (at least) three separate
      problems. First, relevant DDL might commit while we're in the process
      of building a PartitionDesc.  If so, find_inheritance_children() might
      see a new partition while the RELOID system cache still has the old
      partition bound cached, and even before invalidation messages have
      been queued.  To fix that, if we see that the pg_class tuple seems to
      be missing or to have a null relpartbound, refetch the value directly
      from the table. We can't get the wrong value, because DETACH PARTITION
      still requires AccessExclusiveLock throughout; if we ever want to
      change that, this will need more thought. In testing, I found it quite
      difficult to hit even the null-relpartbound case; the race condition
      is extremely tight, but the theoretical risk is there.
      
      Second, successive calls to RelationGetPartitionDesc might not return
      the same answer.  The query planner will get confused if lookup up the
      PartitionDesc for a particular relation does not return a consistent
      answer for the entire duration of query planning.  Likewise, query
      execution will get confused if the same relation seems to have a
      different PartitionDesc at different times.  Invent a new
      PartitionDirectory concept and use it to ensure consistency.  This
      ensures that a single invocation of either the planner or the executor
      sees the same view of the PartitionDesc from beginning to end, but it
      does not guarantee that the planner and the executor see the same
      view.  Since this allows pointers to old PartitionDesc entries to
      survive even after a relcache rebuild, also postpone removing the old
      PartitionDesc entry until we're certain no one is using it.
      
      For the most part, it seems to be OK for the planner and executor to
      have different views of the PartitionDesc, because the executor will
      just ignore any concurrently added partitions which were unknown at
      plan time; those partitions won't be part of the inheritance
      expansion, but invalidation messages will trigger replanning at some
      point.  Normally, this happens by the time the very next command is
      executed, but if the next command acquires no locks and executes a
      prepared query, it can manage not to notice until a new transaction is
      started.  We might want to tighten that up, but it's material for a
      separate patch.  There would still be a small window where a query
      that started just after an ATTACH PARTITION command committed might
      fail to notice its results -- but only if the command starts before
      the commit has been acknowledged to the user. All in all, the warts
      here around serializability seem small enough to be worth accepting
      for the considerable advantage of being able to add partitions without
      a full table lock.
      
      Although in general the consequences of new partitions showing up
      between planning and execution are limited to the query not noticing
      the new partitions, run-time partition pruning will get confused in
      that case, so that's the third problem that this patch fixes.
      Run-time partition pruning assumes that indexes into the PartitionDesc
      are stable between planning and execution.  So, add code so that if
      new partitions are added between plan time and execution time, the
      indexes stored in the subplan_map[] and subpart_map[] arrays within
      the plan's PartitionedRelPruneInfo get adjusted accordingly.  There
      does not seem to be a simple way to generalize this scheme to cope
      with partitions that are removed, mostly because they could then get
      added back again with different bounds, but it works OK for added
      partitions.
      
      This code does not try to ensure that every backend participating in
      a parallel query sees the same view of the PartitionDesc.  That
      currently doesn't matter, because we never pass PartitionDesc
      indexes between backends.  Each backend will ignore the concurrently
      added partitions which it notices, and it doesn't matter if different
      backends are ignoring different sets of concurrently added partitions.
      If in the future that matters, for example because we allow writes in
      parallel query and want all participants to do tuple routing to the same
      set of partitions, the PartitionDirectory concept could be improved to
      share PartitionDescs across backends.  There is a draft patch to
      serialize and restore PartitionDescs on the thread where this patch
      was discussed, which may be a useful place to start.
      
      Patch by me.  Thanks to Alvaro Herrera, David Rowley, Simon Riggs,
      Amit Langote, and Michael Paquier for discussion, and to Alvaro
      Herrera for some review.
      
      Discussion: http://postgr.es/m/CA+Tgmobt2upbSocvvDej3yzokd7AkiT+PvgFH+a9-5VV1oJNSQ@mail.gmail.com
      Discussion: http://postgr.es/m/CA+TgmoZE0r9-cyA-aY6f8WFEROaDLLL7Vf81kZ8MtFCkxpeQSw@mail.gmail.com
      Discussion: http://postgr.es/m/CA+TgmoY13KQZF-=HNTrt9UYWYx3_oYOQpu9ioNT49jGgiDpUEA@mail.gmail.com
      898e5e32
    • Alvaro Herrera's avatar
      Fix broken markup · ec51727f
      Alvaro Herrera authored
      ec51727f
    • Alvaro Herrera's avatar
      Fix the BY {REF,VALUE} clause of XMLEXISTS/XMLTABLE · eaaa5986
      Alvaro Herrera authored
      This clause is used to indicate the passing mode of a XML document, but
      we were doing it wrong: we accepted BY REF and ignored it, and rejected
      BY VALUE as a syntax error.  The reality, however, is that documents are
      always passed BY VALUE, so rejecting that clause was silly.  Change
      things so that we accept BY VALUE.
      
      BY REF continues to be accepted, and continues to be ignored.
      
      Author: Chapman Flack
      Reviewed-by: Pavel Stehule
      Discussion: https://postgr.es/m/5C297BB7.9070509@anastigmatix.net
      eaaa5986
    • Alvaro Herrera's avatar
      Add missing <limits.h> · cb706ec4
      Alvaro Herrera authored
      Per buildfarm
      cb706ec4