1. 09 Apr, 2020 10 commits
    • Tom Lane's avatar
      Further stabilize results of 019_replslot_limit.pl. · e083fa34
      Tom Lane authored
      Depending on specific values of restart_lsn or pg_current_wal_lsn()
      is obviously unsafe.  The previous coding tried to dodge this issue
      by rounding off, but that's not good enough, as shown by multiple
      buildfarm members.  Nuke all the uses of these values except for
      null-ness checks, pending some credible argument why we should think
      something else could be usefully stable.
      
      Kyotaro Horiguchi, further modified by me
      
      Discussion: https://postgr.es/m/E1jM1Sa-0003mS-99@gemulon.postgresql.org
      e083fa34
    • Tom Lane's avatar
      Further cleanup of ts_headline code. · 2e0e409e
      Tom Lane authored
      Suppress a probably-meaningless uninitialized-variable warning
      (induced by my previous patch, I'm sorry to say).
      
      Improve mark_hl_fragments()'s test for overlapping cover strings:
      it failed to consider the possibility that the current string is
      strictly within another one.  That's unlikely given the preceding
      splitting into MaxWords fragments, but I don't think it's impossible.
      
      Discussion: https://postgr.es/m/16345-2e0cf5cddbdcd3b4@postgresql.org
      2e0e409e
    • Tom Lane's avatar
      Doc: improve documentation about ts_headline() function. · a4d4f591
      Tom Lane authored
      Now that I've had my nose in that code, I thought the docs about
      it left something to be desired.
      a4d4f591
    • Tom Lane's avatar
      Fix default text search parser's ts_headline code for phrase queries. · c9b0c678
      Tom Lane authored
      This code could produce very poor results when asked to highlight a
      string based on a query using phrase-match operators.  The root cause
      is that hlCover(), which is supposed to find a minimal substring that
      matches the query, was written assuming that word position is not
      significant.  I'm only 95% convinced that its algorithm was correct even
      for plain AND/OR queries; but it definitely fails completely for phrase
      matches, causing it to possibly not identify a cover string at all.
      
      Hence, rewrite hlCover() with a less-tense algorithm that just tries
      all the possible substrings, earlier and shorter ones first.  (This is
      not as bad as it sounds performance-wise, because all of the string
      matching has been done already: the repeated tsquery match checks
      boil down to pointer comparisons.)
      
      Unfortunately, since that approach produces more candidate cover
      strings than before, it also exposes that there were bugs in the
      heuristics in mark_hl_words() for selecting a best cover string.
      Fixes there include:
      * Do not apply the ShortWord filter to words that appear in the query.
      * Remove a misguided optimization for quickly rejecting a cover.
      * Fix order-of-operation bug that could cause computation of a
      wrong figure of merit (poslen) when shortening a cover.
      * Change the preference rule so that candidate headlines that do not
      include their whole cover string (after MaxWords trimming) are lowest
      priority, since they may not actually satisfy the user's query.
      
      This results in some changes in existing regression test cases,
      but they all seem reasonable.  Note in particular that the tests
      involving strings like "1 2 3" were previously being affected by
      the ShortWord filter, masking the normal matching behavior.
      
      Per bug #16345 from Augustinas Jokubauskas; the new test cases are
      based on that example.  Back-patch to 9.6 where phrase search was
      added to tsquery.
      
      Discussion: https://postgr.es/m/16345-2e0cf5cddbdcd3b4@postgresql.org
      c9b0c678
    • Tom Lane's avatar
      Cosmetic improvements for default text search parser's ts_headline code. · b10f8bb9
      Tom Lane authored
      This code was woefully unreadable and under-commented.  Try to improve
      matters by adding comments, using some macros to make complicated
      if-tests more readable, using boolean type where appropriate, etc.
      There are a couple of tiny coding improvements too, but this commit
      includes (I hope) no behavioral change.
      
      Nonetheless, back-patch as far as 9.6, because a followup bug-fixing
      commit depends on this.
      
      Discussion: https://postgr.es/m/16345-2e0cf5cddbdcd3b4@postgresql.org
      b10f8bb9
    • Peter Eisentraut's avatar
      Fix CREATE TABLE LIKE INCLUDING GENERATED column order issue · e92e4a2b
      Peter Eisentraut authored
      CREATE TABLE LIKE INCLUDING GENERATED would fail if a generated column
      referred to a column with a higher attribute number.  This is because
      the column mapping mechanism created the mapping incrementally as
      columns are added.  This was sufficient for previous uses of that
      mechanism (omitting dropped columns), and it also happened to work if
      generated columns only referred to columns with lower attribute
      numbers, but here it failed.
      
      This fix is to build the attribute mapping in a separate loop before
      processing the columns in detail.
      
      Bug: #16342
      Reported-by: default avatarEthan Waldo <ewaldo@healthetechs.com>
      Reviewed-by: default avatarTom Lane <tgl@sss.pgh.pa.us>
      e92e4a2b
    • Fujii Masao's avatar
      Fix typo in pg_validatebackup documentation. · c4f82a77
      Fujii Masao authored
      Author: Fujii Masao
      Reviewed-by: Robert Haas
      Discussion: https://postgr.es/m/78f76a3d-1a28-a97d-0394-5c96985dd1c0@oss.nttdata.com
      c4f82a77
    • Fujii Masao's avatar
      Exclude backup_manifest file that existed in database, from BASE_BACKUP. · 1ec50a81
      Fujii Masao authored
      If there is already a backup_manifest file in the database cluster,
      it belongs to the past backup that was used to start this server.
      It is not correct for the backup being taken now. So this commit
      changes pg_basebackup so that it always skips such backup_manifest
      file. The backup_manifest file for the current backup will be injected
      separately if users want it.
      
      Author: Fujii Masao
      Reviewed-by: Robert Haas
      Discussion: https://postgr.es/m/78f76a3d-1a28-a97d-0394-5c96985dd1c0@oss.nttdata.com
      1ec50a81
    • Amit Kapila's avatar
      Allow parallel create index to accumulate buffer usage stats. · 5c713621
      Amit Kapila authored
      Currently, we don't account for buffer usage incurred by parallel workers
      for parallel create index.  This commit allows each worker to record the
      buffer usage stats and leader backend to accumulate that stats at the
      end of the operation.  This will allow pg_stat_statements to display
      correct buffer usage stats for (parallel) create index command.
      
      Reported-by: Julien Rouhaud
      Author: Sawada Masahiko
      Reviewed-by: Dilip Kumar, Julien Rouhaud and Amit Kapila
      Backpatch-through: 11, where this was introduced
      Discussion: https://postgr.es/m/20200328151721.GB12854@nol
      5c713621
    • Fujii Masao's avatar
      Add note in pg_stat_statements documentation about planning statistics. · 58ad961f
      Fujii Masao authored
      The added note explains that the numbers of planning and execution in
      the statement are not always expected to match because their statistics are
      updated at their respective end phase, and only for successful operations.
      
      Author: Pascal Legrand, Julien Rouhaud, tweaked a bit by Fujii Masao
      Discussion: https://postgr.es/m/1585857868967-0.post@n3.nabble.com
      58ad961f
  2. 08 Apr, 2020 21 commits
  3. 07 Apr, 2020 9 commits