1. 21 Apr, 2021 7 commits
  2. 20 Apr, 2021 9 commits
    • Tom Lane's avatar
      Improve WAL record descriptions for SP-GiST records. · 783be78c
      Tom Lane authored
      While tracking down the bug fixed in the preceding commit, I got quite
      annoyed by the low quality of spg_desc's output.  Add missing fields,
      try to make the formatting consistent.
      783be78c
    • Tom Lane's avatar
      Fix under-parenthesized XLogRecHasBlockRef() macro. · 9e411482
      Tom Lane authored
      Commit f003d9f8 left this macro with inadequate (or, one could say,
      too much) parenthesization.  Which was catastrophic to the correctness
      of calls such as "if (!XLogRecHasBlockRef(record, 1)) ...".  There
      are only a few of those, which perhaps explains why we didn't notice
      immediately (with our general weakness of WAL replay testing being
      another factor).  I found it by debugging intermittent replay failures
      like
      
      2021-04-08 14:33:30.191 EDT [29463] PANIC:  failed to locate backup block with ID 1
      2021-04-08 14:33:30.191 EDT [29463] CONTEXT:  WAL redo at 0/95D3438 for SPGist/ADD_NODE: off 1; blkref #0: rel 1663/16384/25998, blk 1
      9e411482
    • Bruce Momjian's avatar
      Fix interaction of log_line_prefix's query_id and log_statement · db01f797
      Bruce Momjian authored
      log_statement is issued before query_id can be computed, so properly
      clear the value, and document the interaction.
      
      Reported-by: Fujii Masao, Michael Paquier
      
      Discussion: https://postgr.es/m/YHPkU8hFi4no4NSw@paquier.xyz
      
      Author: Julien Rouhaud
      db01f797
    • Bruce Momjian's avatar
      adjust query id feature to use pg_stat_activity.query_id · 9660834d
      Bruce Momjian authored
      Previously, it was pg_stat_activity.queryid to match the
      pg_stat_statements queryid column.  This is an adjustment to patch
      4f0b0966.  This also adjusts some of the internal function calls to
      match.  Catversion bumped.
      
      Reported-by: Álvaro Herrera, Julien Rouhaud
      
      Discussion: https://postgr.es/m/20210408032704.GA7498@alvherre.pgsql
      9660834d
    • Tom Lane's avatar
      Rename find_em_expr_usable_for_sorting_rel. · 76453767
      Tom Lane authored
      I didn't particularly like this function name, as it fails to
      express what's going on.  Also, returning the sort expression
      alone isn't too helpful --- typically, a caller would also
      need some other fields of the EquivalenceMember.  But the
      sole caller really only needs a bool result, so let's make
      it "bool relation_can_be_sorted_early()".
      
      Discussion: https://postgr.es/m/91f3ec99-85a4-fa55-ea74-33f85a5c651f@swarm64.com
      76453767
    • Tom Lane's avatar
      Fix planner failure in some cases of sorting by an aggregate. · 37539824
      Tom Lane authored
      An oversight introduced by the incremental-sort patches caused
      "could not find pathkey item to sort" errors in some situations
      where a sort key involves an aggregate or window function.
      
      The basic problem here is that find_em_expr_usable_for_sorting_rel
      isn't properly modeling what prepare_sort_from_pathkeys will do
      later.  Rather than hoping we can keep those functions in sync,
      let's refactor so that they actually share the code for
      identifying a suitable sort expression.
      
      With this refactoring, tlist.c's tlist_member_ignore_relabel
      is unused.  I removed it in HEAD but left it in place in v13,
      in case any extensions are using it.
      
      Per report from Luc Vlaming.  Back-patch to v13 where the
      problem arose.
      
      James Coleman and Tom Lane
      
      Discussion: https://postgr.es/m/91f3ec99-85a4-fa55-ea74-33f85a5c651f@swarm64.com
      37539824
    • Andrew Dunstan's avatar
      Avoid unfortunate IPC::Run path caching in PostgresNode · 95c3a195
      Andrew Dunstan authored
      Commit b34ca595 provided for installation-aware instances of
      PostgresNode. However, it turns out that IPC::Run works against this by
      caching the path to a binary and not consulting the path again, even if
      it has changed. We work around this by calling Postgres binaries with
      the installed path rather than just a bare name to be looked up in the
      environment path, if there is an installed path. For the common case
      where there is no installed path we continue to use the bare command
      name.
      
      Diagnosis and solution from Mark Dilger
      
      Discussion: https://postgr.es/m/E8F512F8-B4D6-4514-BA8D-2E671439DA92@enterprisedb.com
      95c3a195
    • Magnus Hagander's avatar
      Fix typo in comment · 8b4b5669
      Magnus Hagander authored
      Author: Julien Rouhaud
      Backpatch-through: 11
      Discussion: https://postgr.es/m/20210420121659.odjueyd4rpilorn5@nol
      8b4b5669
    • Peter Geoghegan's avatar
      Document LP_DEAD accounting issues in VACUUM. · 7136bf34
      Peter Geoghegan authored
      Document VACUUM's soft assumption that any LP_DEAD items encountered
      during pruning will become LP_UNUSED items before VACUUM finishes up.
      This is integral to the accounting used by VACUUM to generate its final
      report on the table to the stats collector.  It also affects how VACUUM
      determines which heap pages are truncatable.  In both cases VACUUM is
      concerned with the likely contents of the page in the near future, not
      the current contents of the page.
      
      This state of affairs created the false impression that VACUUM's dead
      tuple accounting had significant difference with similar accounting used
      during ANALYZE.  There were and are no substantive differences, at least
      when the soft assumption completely works out.  This is far clearer now.
      
      Also document cases where things don't quite work out for VACUUM's dead
      tuple accounting.  It's possible that a significant number of LP_DEAD
      items will be left behind by VACUUM, and won't be recorded as remaining
      dead tuples in VACUUM's statistics collector report.  This behavior
      dates back to commit a96c41fe, which taught VACUUM to run without index
      and heap vacuuming at the user's request.  The failsafe mechanism added
      to VACUUM more recently by commit 1e55e7d1 takes the same approach to
      dead tuple accounting.
      Reported-By: default avatarMasahiko Sawada <sawada.mshk@gmail.com>
      Discussion: https://postgr.es/m/CAH2-Wz=Jmtu18PrsYq3EvvZJGOmZqSO2u3bvKpx9xJa5uhNp=Q@mail.gmail.com
      7136bf34
  3. 19 Apr, 2021 4 commits
  4. 18 Apr, 2021 2 commits
  5. 17 Apr, 2021 3 commits
    • Peter Eisentraut's avatar
      f7c09706
    • Peter Eisentraut's avatar
      Use correct format placeholder for block numbers · f59b58e2
      Peter Eisentraut authored
      Should be %u rather than %d.
      f59b58e2
    • Tom Lane's avatar
      Rethink extraction of collation dependencies. · f24b1569
      Tom Lane authored
      As it stands, find_expr_references_walker() pays attention to leaf-node
      collation fields while ignoring the input collations of actual function
      and operator nodes.  That seems exactly backwards from a semantic
      standpoint, and it leads to reporting dependencies on collations that
      really have nothing to do with the expression's behavior.
      
      Hence, rewrite to look at function input collations instead.  This
      isn't completely perfect either; it fails to account for the behavior
      of record_eq and its siblings.  (The previous coding at least gave an
      approximation of that, though I think it could be fooled pretty easily
      into considering the columns of irrelevant composite types.)  We may
      be able to improve on this later, but for now this should satisfy the
      buildfarm members that didn't like ef387bed.
      
      In passing fix some oversights in GetTypeCollations(), and get
      rid of its duplicative de-duplications.  (I'm worried that it's
      still potentially O(N^2) or worse, but this makes it a little
      better.)
      
      Discussion: https://postgr.es/m/3564817.1618420687@sss.pgh.pa.us
      f24b1569
  6. 16 Apr, 2021 11 commits
  7. 15 Apr, 2021 4 commits
    • Tom Lane's avatar
      Provide query source text when parsing a SQL-standard function body. · 40972336
      Tom Lane authored
      Without this, we lose error cursor positions, as shown in the
      modified regression test result.
      
      Discussion: https://postgr.es/m/2197698.1617984583@sss.pgh.pa.us
      40972336
    • Tom Lane's avatar
      Revert "Cope with NULL query string in ExecInitParallelPlan()." · 83efce7a
      Tom Lane authored
      This reverts commit b3ee4c50.
      We don't need it in the wake of the preceding commit, which
      added an upstream check that the querystring isn't null.
      
      Discussion: https://postgr.es/m/2197698.1617984583@sss.pgh.pa.us
      83efce7a
    • Tom Lane's avatar
      Undo decision to allow pg_proc.prosrc to be NULL. · 1111b266
      Tom Lane authored
      Commit e717a9a1 changed the longstanding rule that prosrc is NOT NULL
      because when a SQL-language function is written in SQL-standard style,
      we don't currently have anything useful to put there.  This seems a poor
      decision though, as it could easily have negative impacts on external
      PLs (opening them to crashes they didn't use to have, for instance).
      SQL-function-related code can just as easily test "is prosqlbody not
      null" as "is prosrc null", so there's no real gain there either.
      Hence, revert the NOT NULL marking removal and adjust related logic.
      
      For now, we just put an empty string into prosrc for SQL-standard
      functions.  Maybe we'll have a better idea later, although the
      history of things like pg_attrdef.adsrc suggests that it's not
      easy to maintain a string equivalent of a node tree.
      
      This also adds an assertion that queryDesc->sourceText != NULL
      to standard_ExecutorStart.  We'd been silently relying on that
      for awhile, so let's make it less silent.
      
      Also fix some overlooked documentation and test cases.
      
      Discussion: https://postgr.es/m/2197698.1617984583@sss.pgh.pa.us
      1111b266
    • Tom Lane's avatar
      Stabilize recently-added information_schema test queries. · 3157cbe9
      Tom Lane authored
      These queries could show unexpected entries if the core system,
      or concurrently-running test scripts, created any functions that
      would appear in the information_schema views.  Restrict them
      to showing functions belonging to this test's schema, as the
      far-older nearby test case does.
      
      Per experimentation with conversion of some built-in functions
      to SQL-function-body style.
      3157cbe9