1. 21 Apr, 2020 4 commits
  2. 20 Apr, 2020 6 commits
  3. 19 Apr, 2020 4 commits
    • Tom Lane's avatar
      Doc: update the rest of section 9.4 for new function table layout. · 9aece5cd
      Tom Lane authored
      Notably, this replaces the previous handwaving about these functions'
      behavior with "character"-type inputs with some actual facts.
      9aece5cd
    • Jeff Davis's avatar
      0cacb2b7
    • Tom Lane's avatar
      Doc: update sections 9.1-9.3 for new function table layout. · 81e83216
      Tom Lane authored
      I took the opportunity to do some copy-editing in this area as well,
      and to add some new material such as a note about BETWEEN's syntactical
      peculiarities.
      
      Of note is that quite a few of the examples of transcendental functions
      needed to be updated, because the displayed output no longer matched
      what you get on a modern server.  I believe some of these cases are
      side-effects of the new Ryu algorithm in float8out.  Others appear to be
      because the examples predate the addition of type numeric, and were
      expecting that float8 calculations would be done although the given
      syntax would actually lead to calling the numeric function nowadays.
      81e83216
    • Peter Eisentraut's avatar
      Fix update-unicode target · 73afabcd
      Peter Eisentraut authored
      The normalization-check target needs to be run last, after moving the
      newly generated files into place.  Also, we need an additional
      dependency so that unicode_norm.o is rebuilt first.  Otherwise,
      norm_test will still test the old files but against the new expected
      results, which will probably fail.
      73afabcd
  4. 18 Apr, 2020 4 commits
    • Tom Lane's avatar
      Doc: sync functableentry markup choices with website style. · 00f4aba4
      Tom Lane authored
      Jonathan Katz felt that slightly different indentation settings made
      for a better-looking result, so sync stylesheet-fo.xsl (for PDF) and
      stylesheet.css (for non-website-style HTML) with those choices.
      
      Discussion: https://postgr.es/m/31464.1587156281@sss.pgh.pa.us
      00f4aba4
    • Tom Lane's avatar
      Fix race conditions in synchronous standby management. · f332241a
      Tom Lane authored
      We have repeatedly seen the buildfarm reach the Assert(false) in
      SyncRepGetSyncStandbysPriority.  This apparently is due to failing to
      consider the possibility that the sync_standby_priority values in
      shared memory might be inconsistent; but they will be whenever only
      some of the walsenders have updated their values after a change in
      the synchronous_standby_names setting.  That function is vastly too
      complex for what it does, anyway, so rewriting it seems better than
      trying to apply a band-aid fix.
      
      Furthermore, the API of SyncRepGetSyncStandbys is broken by design:
      it returns a list of WalSnd array indexes, but there is nothing
      guaranteeing that the contents of the WalSnd array remain stable.
      Thus, if some walsender exits and then a new walsender process
      takes over that WalSnd array slot, a caller might make use of
      WAL position data that it should not, potentially leading to
      incorrect decisions about whether to release transactions that
      are waiting for synchronous commit.
      
      To fix, replace SyncRepGetSyncStandbys with a new function
      SyncRepGetCandidateStandbys that copies all the required data
      from shared memory while holding the relevant mutexes.  If the
      associated walsender process then exits, this data is still safe to
      make release decisions with, since we know that that much WAL *was*
      sent to a valid standby server.  This incidentally means that we no
      longer need to treat sync_standby_priority as protected by the
      SyncRepLock rather than the per-walsender mutex.
      
      SyncRepGetSyncStandbys is no longer used by the core code, so remove
      it entirely in HEAD.  However, it seems possible that external code is
      relying on that function, so do not remove it from the back branches.
      Instead, just remove the known-incorrect Assert.  When the bug occurs,
      the function will return a too-short list, which callers should treat
      as meaning there are not enough sync standbys, which seems like a
      reasonably safe fallback until the inconsistent state is resolved.
      Moreover it's bug-compatible with what has been happening in non-assert
      builds.  We cannot do anything about the walsender-replacement race
      condition without an API/ABI break.
      
      The bogus assertion exists back to 9.6, but 9.6 is sufficiently
      different from the later branches that the patch doesn't apply at all.
      I chose to just remove the bogus assertion in 9.6, feeling that the
      probability of a bad outcome from the walsender-replacement race
      condition is too low to justify rewriting the whole patch for 9.6.
      
      Discussion: https://postgr.es/m/21519.1585272409@sss.pgh.pa.us
      f332241a
    • David Rowley's avatar
      Fix possible crash with GENERATED ALWAYS columns · 3cb02e30
      David Rowley authored
      In some corner cases, this could also lead to corrupted values being
      included in the tuple.
      
      Users who are concerned that they are affected by this should first
      upgrade and then perform a base backup of their database and restore onto
      an off-line server. They should then query each table with generated
      columns to ensure there are no rows where the generated expression does
      not match a newly calculated version of the GENERATED ALWAYS expression.
      If no crashes occur and no rows are returned then you're not affected.
      
      Fixes bug #16369.
      
      Reported-by: Cameron Ezell
      Discussion: https://postgr.es/m/16369-5845a6f1bef59884@postgresql.org
      Backpatch-through: 12 (where GENERATED ALWAYS columns were added.)
      3cb02e30
    • Tom Lane's avatar
      Doc: revise formatting of function/operator tables. · 737d69ff
      Tom Lane authored
      The table layout ideas proposed in commit e894c618 were not as widely
      popular as I'd hoped.  After discussion, we've settled on a layout
      that's effectively a single-column table with cell contents much like a
      <varlistentry> description of the function or operator; though we're not
      actually using <varlistentry>, because it'd add way too much vertical
      space.  Instead the effect is accomplished using line-break processing
      instructions to separate the description and example(s), plus CSS or FO
      customizations to produce indentation of all but the first line in each
      cell.  While technically this is a bit grotty, it does have the
      advantage that we won't need to write nearly as much boilerplate markup.
      
      This patch updates tables 9.30, 9.31, and 9.33 (which were touched by
      the previous patch) to the revised style, and additionally converts
      table 9.10.  A lot of work still remains to do, but hopefully it won't
      be too controversial.
      
      Thanks to Andrew Dunstan, Pierre Giraud, Robert Haas, Alvaro Herrera,
      David Johnston, Jonathan Katz, Isaac Morland for valuable ideas.
      
      Discussion: https://postgr.es/m/8691.1586798003@sss.pgh.pa.us
      737d69ff
  5. 17 Apr, 2020 7 commits
  6. 16 Apr, 2020 4 commits
    • David Rowley's avatar
      Remove unneeded constraint dependency tracking · 5b736e9c
      David Rowley authored
      It was previously thought that remove_useless_groupby_columns() needed to
      keep track of which constraints the generated plan depended upon, however,
      this is unnecessary. The confusion likely arose regarding this because of
      check_functional_grouping(), which does need to track the dependency to
      ensure VIEWs with columns which are functionally dependant on the GROUP BY
      remain so. For remove_useless_groupby_columns(), cached plans will just
      become invalidated when the primary key's underlying index is removed
      through the normal relcache invalidation code.
      
      Here we just remove the unneeded code which records the dependency and
      updates the comments. The previous comments claimed that we could not use
      UNIQUE constraints for the same optimization due to lack of a
      pg_constraint record for NOT NULL constraints (which are required because
      NULLs can be duplicated in a unique index). Since we don't actually need a
      pg_constraint record to handle the invalidation, it looks like we could
      add code to do this in the future. But not today.
      
      We're not really fixing any bug in the code here, this fix is just to set
      the record straight on UNIQUE constraints. This code was added back in
      9.6, but due to lack of any bug, we'll not be backpatching this.
      
      Reviewed-by: Tom Lane
      Discussion: https://postgr.es/m/CAApHDvrdYa=VhOoMe4ZZjZ-G4ALnD-xuAeUNCRTL+PYMVN8OnQ@mail.gmail.com
      5b736e9c
    • Tom Lane's avatar
      Fix cache reference leak in contrib/sepgsql. · fc576b7c
      Tom Lane authored
      fixup_whole_row_references() did the wrong thing with a dropped column,
      resulting in a commit-time warning about a cache reference leak.
      
      I (tgl) added a test case exercising this, but back-patched the test
      only as far as v10; the patch didn't apply cleanly to 9.6 and it
      didn't seem worth the trouble to adapt it.  The bug is pretty old
      though, so apply the code change all the way back.
      
      Michael Luo, with cosmetic improvements by me
      
      Discussion: https://postgr.es/m/BYAPR08MB5606D1453D7F50E2AF4D2FD29AD80@BYAPR08MB5606.namprd08.prod.outlook.com
      fc576b7c
    • Amit Kapila's avatar
      Fix the usage of parallel and full options of vacuum command. · 24d2d38b
      Amit Kapila authored
      Earlier we were inconsistent in allowing the usage of parallel and
      full options.  Change it such that we disallow them only when they are
      combined in a way that we don't support.
      
      In passing, improve the comments in some of the existing tests of parallel
      vacuum.
      
      Reported-by: Tushar Ahuja
      Author: Justin Pryzby, Amit Kapila
      Reviewed-by: Sawada Masahiko, Michael Paquier, Mahendra Singh Thalor and
      Amit Kapila
      Discussion: https://postgr.es/m/58c8d171-e665-6fa3-a9d3-d9423b694dae%40enterprisedb.com
      24d2d38b
    • Michael Paquier's avatar
      Disable silently generation of manifests with servers <= 12 in pg_basebackup · 542d7817
      Michael Paquier authored
      Since 0d8c9c12, pg_basebackup would generate an error if connected to a
      backend version older than 12 where backup manifests are not supported.
      Avoiding this error is possible by using the --no-manifest option.
      
      This error handling could be confusing for some users, where patching a
      backup script that interacts with multiple backend versions would cause
      the addition of --no-manifest to potentially not generate a backup
      manifest even for Postgres 13 and newer versions.  As we want to
      encourage the use of backup manifests as much as possible, this commit
      silently disables manifests where not supported, instead of generating
      an error.
      
      While on it, rework a bit the code to make it more consistent with the
      surroundings when generating the BASE_BACKUP command.
      
      Per discussion with Andres Freund, Stephen Frost, Robert Haas, Álvaro
      Herrera, Kyotaro Horiguchi, Tom Lane, David Steele, and me.
      
      Author: Michael Paquier
      Discussion: https://postgr.es/m/20200410080910.GZ1606@paquier.xyz
      542d7817
  7. 15 Apr, 2020 3 commits
  8. 14 Apr, 2020 8 commits