1. 28 Sep, 2021 3 commits
  2. 27 Sep, 2021 3 commits
  3. 26 Sep, 2021 1 commit
  4. 25 Sep, 2021 6 commits
  5. 23 Sep, 2021 4 commits
  6. 22 Sep, 2021 2 commits
    • Amit Kapila's avatar
      Invalidate all partitions for a partitioned table in publication. · 9eff8593
      Amit Kapila authored
      Updates/Deletes on a partition were allowed even without replica identity
      after the parent table was added to a publication. This would later lead
      to an error on subscribers. The reason was that we were not invalidating
      the partition's relcache and the publication information for partitions
      was not getting rebuilt. Similarly, we were not invalidating the
      partitions' relcache after dropping a partitioned table from a publication
      which will prohibit Updates/Deletes on its partition without replica
      identity even without any publication.
      
      Reported-by: Haiying Tang
      Author: Hou Zhijie and Vignesh C
      Reviewed-by: Vignesh C and Amit Kapila
      Backpatch-through: 13
      Discussion: https://postgr.es/m/OS0PR01MB6113D77F583C922F1CEAA1C3FBD29@OS0PR01MB6113.jpnprd01.prod.outlook.com
      9eff8593
    • Peter Geoghegan's avatar
      Fix "single value strategy" index deletion issue. · e665129c
      Peter Geoghegan authored
      It is not appropriate for deduplication to apply single value strategy
      when triggered by a bottom-up index deletion pass.  This wastes cycles
      because later bottom-up deletion passes will overinterpret older
      duplicate tuples that deduplication actually just skipped over "by
      design".  It also makes bottom-up deletion much less effective for low
      cardinality indexes that happen to cross a meaningless "index has single
      key value per leaf page" threshold.
      
      To fix, slightly narrow the conditions under which deduplication's
      single value strategy is considered.  We already avoided the strategy
      for a unique index, since our high level goal must just be to buy time
      for VACUUM to run (not to buy space).  We'll now also avoid it when we
      just had a bottom-up pass that reported failure.  The two cases share
      the same high level goal, and already overlapped significantly, so this
      approach is quite natural.
      
      Oversight in commit d168b666, which added bottom-up index deletion.
      
      Author: Peter Geoghegan <pg@bowt.ie>
      Discussion: https://postgr.es/m/CAH2-WznaOvM+Gyj-JQ0X=JxoMDxctDTYjiEuETdAGbF5EUc3MA@mail.gmail.com
      Backpatch: 14-, where bottom-up deletion was introduced.
      e665129c
  7. 21 Sep, 2021 3 commits
    • Michael Paquier's avatar
      Fix places in TestLib.pm in need of adaptation to the output of Msys perl · 90251ff1
      Michael Paquier authored
      Contrary to the output of native perl, Msys perl generates outputs with
      CRLFs characters.  There are already places in the TAP code where CRLFs
      (\r\n) are automatically converted to LF (\n) on Msys, but we missed a
      couple of places when running commands and using their output for
      comparison, that would lead to failures.
      
      This problem has been found thanks to the test added in 5adb067 using
      TestLib::command_checks_all(), but after a closer look more code paths
      were missing a filter.
      
      This is backpatched all the way down to prevent any surprises if a new
      test is introduced in stable branches.
      
      Reviewed-by: Andrew Dunstan, Álvaro Herrera
      Discussion: https://postgr.es/m/1252480.1631829409@sss.pgh.pa.us
      Backpatch-through: 9.6
      90251ff1
    • Tom Lane's avatar
      Fix misevaluation of STABLE parameters in CALL within plpgsql. · 2ad5f963
      Tom Lane authored
      Before commit 84f5c290, a STABLE function in a plpgsql CALL
      statement's argument list would see an up-to-date snapshot,
      because exec_stmt_call would push a new snapshot.  I got rid of
      that because the possibility of the snapshot disappearing within
      COMMIT made it too hard to manage a snapshot across the CALL
      statement.  That's fine so far as the procedure itself goes,
      but I forgot to think about the possibility of STABLE functions
      within the CALL argument list.  As things now stand, those'll
      be executed with the Portal's snapshot as ActiveSnapshot,
      keeping them from seeing updates more recent than Portal startup.
      
      (VOLATILE functions don't have a problem because they take their
      own snapshots; which indeed is also why the procedure itself
      doesn't have a problem.  There are no STABLE procedures.)
      
      We can fix this by pushing a new snapshot transiently within
      ExecuteCallStmt itself.  Popping the snapshot before we get
      into the procedure proper eliminates the management problem.
      The possibly-useless extra snapshot-grab is slightly annoying,
      but it's no worse than what happened before 84f5c290.
      
      Per bug #17199 from Alexander Nawratil.  Back-patch to v11,
      like the previous patch.
      
      Discussion: https://postgr.es/m/17199-1ab2561f0d94af92@postgresql.org
      2ad5f963
    • Alvaro Herrera's avatar
      Document XLOG_INCLUDE_XID a little better · c1d1ae1d
      Alvaro Herrera authored
      I noticed that commit 0bead9af left this flag undocumented in
      XLogSetRecordFlags, which led me to discover that the flag doesn't
      actually do what the one comment on it said it does.  Improve the
      situation by adding some more comments.
      
      Backpatch to 14, where the aforementioned commit appears.
      
      Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
      Discussion: https://postgr.es/m/202109212119.c3nhfp64t2ql@alvherre.pgsql
      c1d1ae1d
  8. 20 Sep, 2021 5 commits
  9. 19 Sep, 2021 3 commits
  10. 18 Sep, 2021 2 commits
  11. 17 Sep, 2021 2 commits
    • Peter Geoghegan's avatar
      pageinspect: Make page deletion elog less chatty. · 55934416
      Peter Geoghegan authored
      An elog that reports the value of a transaction ID stored on a deleted
      nbtree page was added by commit e5d8a999, which taught page deletion to
      store full 64-bit XIDs.  It seems very chatty on further reflection, so
      lower its elevel from NOTICE to DEBUG2.
      
      Author: Peter Geoghegan <pg@bowt.ie>
      Backpatch: 14-, just like the nbtree XID enhancement.
      55934416
    • Tom Lane's avatar
      Fix pull_varnos to cope with translated PlaceHolderVars. · 4d5b4483
      Tom Lane authored
      Commit 55dc86ec changed pull_varnos to use (if possible) the associated
      ph_eval_at for a PlaceHolderVar.  I missed a fine point though: we might
      be looking at a PHV in the quals or tlist of a child appendrel, in which
      case we need to compute a ph_eval_at value that's been translated in the
      same way that the PHV itself has been (cf. adjust_appendrel_attrs).
      Fortunately, enough info is available in the PlaceHolderInfo to make
      such translation possible without additional outside data, so we don't
      need another round of uglification of planner APIs.  This is a little
      bit complicated, but since it's a hard-to-hit corner case, I'm not much
      worried about adding cycles here.
      
      Per report from Jaime Casanova.  Back-patch to v12, like the previous
      commit.
      
      Discussion: https://postgr.es/m/20210915230959.GB17635@ahch-to
      4d5b4483
  12. 16 Sep, 2021 5 commits
    • Tom Lane's avatar
      Fix EXPLAIN to handle SEARCH BREADTH FIRST queries. · 38872675
      Tom Lane authored
      The rewriter transformation for SEARCH BREADTH FIRST produces a
      FieldSelect on a Var of type RECORD, where the Var references the
      recursive union's worktable output.  EXPLAIN VERBOSE failed to handle
      this case, because it only expected such Vars to appear in CteScans
      not WorkTableScans.  Fix that, and add some test cases exercising
      EXPLAIN on SEARCH and CYCLE queries.
      
      In principle this oversight is an old bug, but it seems that the
      case is unreachable without SEARCH BREADTH FIRST, because the
      parser fails when attempting to create such a reference manually.
      So for today I'll just patch HEAD/v14.  Someday we might find that
      the code portion of this patch needs to be back-patched further.
      
      Per report from Atsushi Torikoshi.
      
      Discussion: https://postgr.es/m/5bafa66ad529e11860339565c9e7c166@oss.nttdata.com
      38872675
    • Peter Eisentraut's avatar
      Message style improvements · f46dc96f
      Peter Eisentraut authored
      f46dc96f
    • Andres Freund's avatar
      Fix performance regression from session statistics. · 7890a423
      Andres Freund authored
      Session statistics, as introduced by 960869da, had several shortcomings:
      
      - an additional GetCurrentTimestamp() call that also impaired the accuracy of
        the data collected
      
        This can be avoided by passing the current timestamp we already have in
        pgstat_report_stat().
      
      - an additional statistics UDP packet sent every 500ms
      
        This is solved by adding the new statistics to PgStat_MsgTabstat.
        This is conceptually ugly, because session statistics are not
        table statistics.  But the struct already contains data unrelated
        to tables, so there is not much damage done.
      
        Connection and disconnection are reported in separate messages, which
        reduces the number of additional messages to two messages per session and a
        slight increase in PgStat_MsgTabstat size (but the same number of table
        stats fit).
      
      - Session time computation could overflow on systems where long is 32 bit.
      Reported-By: default avatarAndres Freund <andres@anarazel.de>
      Author: Andres Freund <andres@anarazel.de>
      Author: Laurenz Albe <laurenz.albe@cybertec.at>
      Discussion: https://postgr.es/m/20210801205501.nyxzxoelqoo4x2qc%40alap3.anarazel.de
      Backpatch: 14-, where the feature was introduced.
      7890a423
    • Fujii Masao's avatar
      Fix variable shadowing in procarray.c. · 92a8d761
      Fujii Masao authored
      ProcArrayGroupClearXid function has a parameter named "proc",
      but the same name was used for its local variables. This commit fixes
      this variable shadowing, to improve code readability.
      
      Back-patch to all supported versions, to make future back-patching
      easy though this patch is classified as refactoring only.
      
      Reported-by: Ranier Vilela
      Author: Ranier Vilela, Aleksander Alekseev
      https://postgr.es/m/CAEudQAqyoTZC670xWi6w-Oe2_Bk1bfu2JzXz6xRfiOUzm7xbyQ@mail.gmail.com
      92a8d761
    • Fujii Masao's avatar
      Use int instead of size_t in procarray.c. · fe8821ca
      Fujii Masao authored
      All size_t variables declared in procarray.c are actually int ones.
      Let's use int instead of size_t for those variables. Which would
      reduce Wsign-compare compiler warnings.
      
      Back-patch to v14 where commit 941697c3 added size_t variables
      in procarray.c, to make future back-patching easy though
      this patch is classified as refactoring only.
      
      Reported-by: Ranier Vilela
      Author: Ranier Vilela, Aleksander Alekseev
      https://postgr.es/m/CAEudQAqyoTZC670xWi6w-Oe2_Bk1bfu2JzXz6xRfiOUzm7xbyQ@mail.gmail.com
      fe8821ca
  13. 15 Sep, 2021 1 commit
    • Tom Lane's avatar
      Disallow LISTEN in background workers. · d84d62b6
      Tom Lane authored
      It's possible to execute user-defined SQL in some background processes;
      for example, logical replication workers can fire triggers.  This opens
      the possibility that someone would try to execute LISTEN in such a
      context.  But since only regular backends ever call
      ProcessNotifyInterrupt, no messages would actually be received, and
      thus the registered listener would simply prevent the message queue
      from being cleaned.  Eventually NOTIFY would stop working, which is bad.
      
      Perhaps someday somebody will invent infrastructure to make listening
      in a background worker actually useful.  In the meantime, forbid it.
      
      Back-patch to v13, which is where we introduced the MyBackendType
      variable.  It'd be a lot harder to implement the check without that,
      and it doesn't seem worth the trouble.
      
      Discussion: https://postgr.es/m/153243441449.1404.2274116228506175596@wrigleys.postgresql.org
      d84d62b6