1. 24 Dec, 2019 3 commits
    • Alvaro Herrera's avatar
      Avoid splitting C string literals with \-newline · c4dcd914
      Alvaro Herrera authored
      Using \ is unnecessary and ugly, so remove that.  While at it, stitch
      the literals back into a single line: we've long discouraged splitting
      error message literals even when they go past the 80 chars line limit,
      to improve greppability.
      
      Leave contrib/tablefunc alone.
      
      Discussion: https://postgr.es/m/20191223195156.GA12271@alvherre.pgsql
      c4dcd914
    • Michael Paquier's avatar
      Replace use of strerror() with %s by %m in pg_waldump · cce64a51
      Michael Paquier authored
      Since d6c55de1, src/port/snprintf.c is able to use %m instead of
      strerror().  A couple of utilities in src/bin/ have already done the
      switch, and do it now for pg_waldump as this reduces the workload for
      translators.
      
      Note that more could be done, particularly with pgbench.  Thanks to
      Kyotaro Horiguchi for the discussion.
      
      Discussion: https://postgr.es/m/20191129065115.GM2505@paquier.xyz
      cce64a51
    • Thomas Munro's avatar
      Rotate instead of shifting hash join batch number. · e69d6445
      Thomas Munro authored
      Our algorithm for choosing batch numbers turned out not to work
      effectively for multi-billion key inner relations.  We would use
      more hash bits than we have, and effectively concentrate all tuples
      into a smaller number of batches than we intended.  While ideally
      we should switch to wider hashes, for now, change the algorithm to
      one that effectively gives up bits from the bucket number when we
      don't have enough bits.  That means we'll finish up with longer
      bucket chains than would be ideal, but that's better than having
      batches that don't fit in work_mem and can't be divided.
      
      Batch-patch to all supported releases.
      
      Author: Thomas Munro
      Reviewed-by: Tom Lane, thanks also to Tomas Vondra, Alvaro Herrera, Andres Freund for testing and discussion
      Reported-by: James Coleman
      Discussion: https://postgr.es/m/16104-dc11ed911f1ab9df%40postgresql.org
      e69d6445
  2. 23 Dec, 2019 6 commits
    • Joe Conway's avatar
      Disallow null category in crosstab_hash · d5b9c2ba
      Joe Conway authored
      While building a hash map of categories in load_categories_hash,
      resulting category names have not thus far been checked to ensure
      they are not null. Prior to pg12 null category names worked to the
      extent that they did not crash on some platforms. This is because
      those system libraries have an snprintf which can deal with being
      passed a null pointer argument for a string. But even in those cases
      null categories did nothing useful. And on some platforms it crashed.
      As of pg12, our own version of snprintf gets called, and it does
      not deal with null pointer arguments at all, and crashes consistently.
      
      Fix that by disallowing null categories. They never worked usefully,
      and no one has ever asked for them to work previously. Back-patch to
      all supported branches.
      
      Reported-By: Ireneusz Pluta
      Discussion: https://postgr.es/m/16176-7489719b05e4303c@postgresql.org
      d5b9c2ba
    • Tom Lane's avatar
      Disallow partition key expressions that return pseudo-types. · 39ebb943
      Tom Lane authored
      This wasn't checked originally, but it should have been, because
      in general pseudo-types can't be stored to and retrieved from disk.
      Notably, partition bound values of type "record" would not be
      interpretable by another session.
      
      In v12 and HEAD, add another flag to CheckAttributeType's repertoire
      so that it can produce a specific error message for this case.  That's
      infeasible in older branches without an ABI break, so fall back to
      a slightly-less-nicely-worded error message in v10 and v11.
      
      Problem noted by Amit Langote, though this patch is not his initial
      solution.  Back-patch to v10 where partitioning was introduced.
      
      Discussion: https://postgr.es/m/CA+HiwqFUzjfj9HEsJtYWcr1SgQ_=iCAvQ=O2Sx6aQxoDu4OiHw@mail.gmail.com
      39ebb943
    • Tom Lane's avatar
      Prevent a rowtype from being included in itself via a range. · fc769589
      Tom Lane authored
      We probably should have thought of this case when ranges were added,
      but we didn't.  (It's not the fault of commit eb51af71, because
      ranges didn't exist then.)
      
      It's an old bug, so back-patch to all supported branches.
      
      Discussion: https://postgr.es/m/7782.1577051475@sss.pgh.pa.us
      fc769589
    • Alvaro Herrera's avatar
      GetPublicationByName: Don't repeat ourselves · 0fd8cfb2
      Alvaro Herrera authored
      Use get_publication_oid() instead of reimplementing it.
      
      Discussion: https://postgr.es/m/20191220201017.GA17292@alvherre.pgsql
      0fd8cfb2
    • Peter Geoghegan's avatar
      Normalize _bt_finish_split() argument names. · 696cc3a0
      Peter Geoghegan authored
      Make a function prototype argument's name match the function
      definition's argument name.
      696cc3a0
    • Peter Geoghegan's avatar
      Update nbtree LP_DEAD item deletion comments. · fe97c61c
      Peter Geoghegan authored
      Comments about the consequences of clearing the BTP_HAS_GARBAGE page
      flag bit that apply only to VACUUM were added to code that deals with
      opportunistic deletion of LP_DEAD items by commit a760893d.  The same
      comment block was added to both _bt_delitems_vacuum() and
      _bt_delitems_delete().  Correct _bt_delitems_delete()'s copy of the
      comment block.
      
      _bt_delitems_delete() reliably deletes items that were found by caller
      to have their LP_DEAD bit set.  There is no question about whether or
      not unsetting the BTP_HAS_GARBAGE bit can miss some LP_DEAD items that
      were set recently.
      
      Also tweak a related section of the nbtree README.
      fe97c61c
  3. 22 Dec, 2019 2 commits
  4. 21 Dec, 2019 3 commits
    • Tom Lane's avatar
      In pgwin32_open, loop after ERROR_ACCESS_DENIED only if we can't stat. · 5406513e
      Tom Lane authored
      This fixes a performance problem introduced by commit 6d7547c2.
      ERROR_ACCESS_DENIED is returned in some other cases besides the
      delete-pending case considered by that commit; notably, if the
      given path names a directory instead of a plain file.  In that
      case we'll uselessly loop for 1 second before returning the
      failure condition.  That slows down some usage scenarios enough
      to cause test timeout failures on our Windows buildfarm critters.
      
      To fix, try to stat() the file, and sleep/loop only if that fails.
      It will fail in the delete-pending case, and also in the case where
      the deletion completed before we could stat(), so we have the cases
      where we want to loop covered.  In the directory case, the stat()
      should succeed, letting us exit without a wait.
      
      One case where we'll still wait uselessly is if the access-denied
      problem pertains to a directory in the given pathname.  But we don't
      expect that to happen in any performance-critical code path.
      
      There might be room to refine this further, but I'll push it now
      in hopes of making the buildfarm green again.
      
      Back-patch, like the preceding commit.
      
      Alexander Lakhin and Tom Lane
      
      Discussion: https://postgr.es/m/23073.1576626626@sss.pgh.pa.us
      5406513e
    • Bruce Momjian's avatar
      C comment: clarify why psql's help/exit/quit must alone · 4376fdba
      Bruce Momjian authored
      Document why no indentation and why no non-whitespace postfix is
      supported.
      
      Backpatch-through: master
      4376fdba
    • Bruce Momjian's avatar
      docs: clarify handling of column lists in COPY TO/FROM · 4cab43ec
      Bruce Momjian authored
      Previously it was unclear how COPY FROM handled cases where not all
      columns were specified, or if the order didn't match.
      
      Reported-by: pavlo.golub@gmail.com
      
      Discussion: https://postgr.es/m/157487729344.7213.14245726713444755296@wrigleys.postgresql.org
      
      Backpatch-through: 9.4
      4cab43ec
  5. 20 Dec, 2019 7 commits
  6. 19 Dec, 2019 9 commits
  7. 18 Dec, 2019 10 commits