1. 12 Nov, 2020 4 commits
    • Fujii Masao's avatar
      Use standard SIGHUP and SIGTERM handlers in walreceiver. · 1a2ae7c5
      Fujii Masao authored
      Commit 1e53fe0e changed background processes so that they use
      standard SIGHUP handler. Like that, this commit makes walreceiver
      use standard SIGHUP and SIGTERM handlers, to simplify the code.
      
      As the side effect of this commit, walreceiver can wake up and process
      the configuration files promptly when receiving SIGHUP. Because the
      standard SIGHUP handler sets the latch. On the other hand, previously
      there could be a time lag between the receipt of SIGHUP and
      the process of configuration files since the dedicated handler didn't
      set the latch.
      
      Author: Bharath Rupireddy, tweaked by Fujii Masao
      Reviewed-by: Kyotaro Horiguchi, Fujii Masao
      Discussion: https://postgr.es/m/CALj2ACXPorUqePswDtOeM_s82v9RW32E1fYmOPZ5NuE+TWKj_A@mail.gmail.com
      1a2ae7c5
    • Alexander Korotkov's avatar
      Fix name of the macro for getting signature length trgm_gist.c · 8ca8208a
      Alexander Korotkov authored
      911e7020 has introduced the opclass parameters including signature length
      for a set of GiST opclasses.  Due to copy-pasting, macro for getting the
      signature length in trgm_gist.c was named LTREE_GET_ASIGLEN().  Fix that by
      renaming this macro to just GET_SIGLEN().
      
      Backpatch-through: 13
      8ca8208a
    • Fujii Masao's avatar
      pg_stat_statements: track number of rows processed by REFRESH MATERIALIZED VIEW. · b62e6056
      Fujii Masao authored
      Commit 6023b7ea allowed pg_stat_statements to track the number
      of rows retrieved or affected by some utility commands including
      CREATE MATERIALIZED VIEW. However it did not track the rowcount
      of REFRESH MATERIALIZED VIEW. This commit allows pg_stat_statements
      to track that.
      
      To track that, this commit changes the query completion for
      REFRESH MATERIALIZED VIEW so that it saves the rowcount. But note that
      the rowcount is still not displayed in the command completion tag output.
      That is, the display_rowcount flag of CMDTAG_REFRESH_MATERIALIZED_VIEW
      command tag is left false in cmdtaglist.h. Otherwise, the change of
      completion tag output might break applications using it.
      
      Author: Katsuragi Yuta, Seino Yuki
      Reviewed-by: Fujii Masao
      Discussion: https://postgr.es/m/71f6bc72f8bbaa06e701f8bd2562c347@oss.nttdata.com
      Discussion: https://postgr.es/m/aadbfba9-e4bb-9531-6b3a-d13c31c8f4fe@oss.nttdata.com
      b62e6056
    • Michael Paquier's avatar
      Remove useless SHA256 initialization when not using backup manifests · 03f9cd93
      Michael Paquier authored
      Attempting to take a base backup with Postgres linking to a build of
      OpenSSL with FIPS enabled currently fails with or even without a backup
      manifest requested because of this mandatory SHA256 initialization used
      for the manifest file itself.  However, there is no need to do this
      initialization at all if backup manifests are not needed because there
      is no data to append to the manifest.
      
      Note that being able to use backup manifests with OpenSSL+FIPS requires
      a switch of the SHA2 implementation to use EVP, which would cause an ABI
      breakage so this cannot be backpatched to 13 as it has been already
      released, but at least avoiding this SHA256 initialization gives users
      the possibility to take a base backup even when specifying --no-manifest
      with pg_basebackup.
      
      Author: Michael Paquier
      Discussion: https://postgr.es/m/20201110020014.GE1887@paquier.xyz
      Backpatch-through: 13
      03f9cd93
  2. 11 Nov, 2020 9 commits
  3. 10 Nov, 2020 5 commits
  4. 09 Nov, 2020 8 commits
  5. 08 Nov, 2020 4 commits
    • Tom Lane's avatar
      In INSERT/UPDATE, use the table's real tuple descriptor as target. · 8b39345a
      Tom Lane authored
      This back-patches commit 20d3fe90 into the v12 and v13 branches.
      At the time I thought that commit was not fixing any observable
      bug, but Bertrand Drouvot showed otherwise: adding a dropped column
      to the previously-considered scenario crashes v12 and v13, unless the
      dropped column happens to be an integer.  That is, of course, because
      the tupdesc we derive from the plan output tlist fails to describe
      the dropped column accurately, so that we'll do the wrong thing with
      a tuple in which that column isn't NULL.
      
      There is no bug in pre-v12 branches because they already did use
      the table's real tuple descriptor for any trigger-returned tuple.
      It seems that this set of bugs can be blamed on the changes that
      removed es_trig_tuple_slot, though I've not attempted to pin that
      down precisely.
      
      Although there's no code change needed in HEAD, update the test case
      to include a dropped column there too.
      
      Discussion: https://postgr.es/m/db5d97c8-f48a-51e2-7b08-b73d5434d425@amazon.com
      Discussion: https://postgr.es/m/16644-5da7ef98a7ac4545@postgresql.org
      8b39345a
    • Thomas Munro's avatar
      Fix assertion in collation version lookup. · d50e3b1f
      Thomas Munro authored
      Commit 257836a7 included an assertion that a version lookup routine is
      not trying to look up "C" or "POSIX", but that case is reachable with
      the user-facing SQL function pg_collation_actual_version().  Remove the
      assertion.
      d50e3b1f
    • Peter Eisentraut's avatar
      Fix test for error message change · 8cff66d3
      Peter Eisentraut authored
      fix for 6be725e7
      8cff66d3
    • Peter Geoghegan's avatar
      Improve nbtree README's LP_DEAD section. · 5a2f154a
      Peter Geoghegan authored
      The description of how LP_DEAD bit setting by index scans works
      following commit 2ed5b87f was rather unclear.  Clean that up a bit.
      
      Also refer to LP_DEAD bit setting within _bt_check_unique() at the start
      of the same section.  This mechanism may actually be more important than
      the generic kill_prior_tuple mechanism that the section focuses on, so
      it at least deserves to be mentioned in passing.
      5a2f154a
  6. 07 Nov, 2020 9 commits
  7. 06 Nov, 2020 1 commit
    • Tomas Vondra's avatar
      Properly detoast data in brin_form_tuple · 7577dd84
      Tomas Vondra authored
      brin_form_tuple failed to consider the values may be toasted, inserting
      the toast pointer into the index. This may easily result in index
      corruption, as the toast data may be deleted and cleaned up by vacuum.
      The cleanup however does not care about indexes, leaving invalid toast
      pointers behind, which triggers errors like this:
      
        ERROR:  missing chunk number 0 for toast value 16433 in pg_toast_16426
      
      A less severe consequence are inconsistent failures due to the index row
      being too large, depending on whether brin_form_tuple operated on plain
      or toasted version of the row. For example
      
          CREATE TABLE t (val TEXT);
          INSERT INTO t VALUES ('... long value ...')
          CREATE INDEX idx ON t USING brin (val);
      
      would likely succeed, as the row would likely include toast pointer.
      Switching the order of INSERT and CREATE INDEX would likely fail:
      
          ERROR:  index row size 8712 exceeds maximum 8152 for index "idx"
      
      because this happens before the row values are toasted.
      
      The bug exists since PostgreSQL 9.5 where BRIN indexes were introduced.
      So backpatch all the way back.
      
      Author: Tomas Vondra
      Reviewed-by: Alvaro Herrera
      Backpatch-through: 9.5
      Discussion: https://postgr.es/m/20201001184133.oq5uq75sb45pu3aw@development
      Discussion: https://postgr.es/m/20201104010544.zexj52mlldagzowv%40development
      7577dd84