1. 17 Apr, 2020 7 commits
  2. 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
  3. 15 Apr, 2020 3 commits
  4. 14 Apr, 2020 11 commits
  5. 13 Apr, 2020 8 commits
    • Alvaro Herrera's avatar
      Silence Perl warning · e56d717d
      Alvaro Herrera authored
      Now that warnings are enabled across the board, this code that tries to
      print an undef variable emits one.  Silently printing the empty string
      achieves the previous behavior.
      
      Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
      Reviewed-by: default avatarAndrew Dunstan <andrew.dunstan@2ndquadrant.com>
      Discussion: https://postgr.es/m/E1jO1VT-0008Qk-TM@gemulon.postgresql.org
      e56d717d
    • Peter Geoghegan's avatar
      Harmonize nbtree page split point code. · bc3087b6
      Peter Geoghegan authored
      An nbtree split point can be thought of as a point between two adjoining
      tuples from an imaginary version of the page being split that includes
      the incoming/new item (in addition to the items that really are on the
      page).  These adjoining tuples are called the lastleft and firstright
      tuples.
      
      The variables that represent split points contained a field called
      firstright, which is an offset number of the first data item from the
      original page that goes on the new right page.  The corresponding tuple
      from origpage was usually the same thing as the actual firstright tuple,
      but not always: the firstright tuple is sometimes the new/incoming item
      instead.  This situation seems unnecessarily confusing.
      
      Make things clearer by renaming the origpage offset returned by
      _bt_findsplitloc() to "firstrightoff".  We now have a firstright tuple
      and a firstrightoff offset number which are comparable to the
      newitem/lastleft tuples and the newitemoff/lastleftoff offset numbers
      respectively.  Also make sure that we are consistent about how we
      describe nbtree page split point state.
      
      Push the responsibility for dealing with pg_upgrade'd !heapkeyspace
      indexes down to lower level code, relieving _bt_split() from dealing
      with it directly.  This means that we always have a palloc'd left page
      high key on the leaf level, no matter what.  This enables simplifying
      some of the code (and code comments) within _bt_split().
      
      Finally, restructure the page split code to make it clearer why suffix
      truncation (which only takes place during leaf page splits) is
      completely different to the first data item truncation that takes place
      during internal page splits.  Tuples are marked as having fewer
      attributes stored in both cases, and the firstright tuple is truncated
      in both cases, so it's easy to imagine somebody missing the distinction.
      bc3087b6
    • Andrew Dunstan's avatar
      Use perl's $/ more idiomatically · 8f00d84a
      Andrew Dunstan authored
      This replaces a few occurrences of ugly code with a more clean and
      idiomatic usage. The problem was highlighted by perlcritic, but we're
      not enforcing the policy that led to the discovery.
      
      Discussion: https://postgr.es/m/20200412074245.GB623763@rfd.leadboat.com
      8f00d84a
    • Andrew Dunstan's avatar
      Use perl warnings pragma consistently · 7be5d8df
      Andrew Dunstan authored
      We've had a mixture of the warnings pragma, the -w switch on the shebang
      line, and no warnings at all. This patch removes the -w swicth and add
      the warnings pragma to all perl sources missing it. It raises the
      severity of the TestingAndDebugging::RequireUseWarnings  perlcritic
      policy to level 5, so that we catch any future violations.
      
      Discussion: https://postgr.es/m/20200412074245.GB623763@rfd.leadboat.com
      7be5d8df
    • Andrew Dunstan's avatar
      Print policy name in perlcritic messages · 8930e43e
      Andrew Dunstan authored
      This makes it easier to do a web search for details of the policy that's
      been violated, as well as displaying the name that might be needed for a
      policy override.
      
      Various perlcritic settings changes are being discussed, but this one
      should be uncontroversial.
      8930e43e
    • Robert Haas's avatar
      7a6b017b
    • Amit Kapila's avatar
      Cosmetic fixups for WAL usage work. · ef08ca11
      Amit Kapila authored
      Reported-by: Justin Pryzby and Euler Taveira
      Author: Justin Pryzby and Julien Rouhaud
      Reviewed-by: Amit Kapila
      Discussion: https://postgr.es/m/CAB-hujrP8ZfUkvL5OYETipQwA=e3n7oqHFU=4ZLxWS_Cza3kQQ@mail.gmail.com
      ef08ca11
    • Peter Eisentraut's avatar
      Improve error messages after LoadLibrary() · 0c620a58
      Peter Eisentraut authored
      Move the file name to a format parameter to ease translatability.  Add
      error code where missing.  Make the wording consistent.
      0c620a58
  6. 12 Apr, 2020 4 commits
    • Tom Lane's avatar
      Doc: introduce new layout for tables of functions and operators. · e894c618
      Tom Lane authored
      We've long fought with the draconian space limitations of our
      traditional table layout for describing SQL functions and operators.
      This commit introduces a new approach, though so far I've only applied
      it to a few of those tables.  The new way makes use of DocBook's support
      for different layouts in different rows of a table, and allows the
      descriptions and examples for a function or operator to run to several
      lines without as much ugliness and wasted space as before.
      
      The core layout concept is now
      
           Name              Signature
                            Description
                       Example     Example Result
      
      so that a function or operator really has three table rows not one,
      but we group them to look like one row by having the name column
      have only one entry for all three rows.  (Actually, there could be
      four or more rows if you wanted to have more than one example, which
      is another thing that was painful before but works easily now.)
      This is handled by a "morerows" annotation on the name entry, which
      isn't perfect (notably, the toolchain is not smart enough to avoid
      breaking these row groups across PDF pages) but there seems no better
      solution in DocBook.  The name column is normally fairly narrow,
      allowing plenty of space for the other column(s), and not wasting too
      much space when one of the other components runs to multiple lines.
      
      The varying row layout is managed by defining named "spans" and then
      tagging entries with a "spanname" of "name", "sig", "desc", "example",
      or "exresult".  This provides a bit of semantic annotation to go with
      the formatting improvement, which seems like a good thing.  (It seems
      that we have to re-define these spans afresh for each table, which is
      annoying, but it's not any worse than the duplication involved in
      the table headers.  At least that gives us an opportunity to vary the
      relative column widths per-table, which is handy since function tables
      sometimes need much wider name columns than operator tables.)
      
      Signature entries should be written in the style
          <function>fname</function>(<type>typename</type> ...)
          <returnvalue>typename</returnvalue>
      The <returnvalue> tag produces a right arrow before the result type
      name.  (I'll document that convention in a user-visible place later.)
      
      While this provides significantly more horizontal space than before
      for examples, it's still true that PDF output is a lot narrower than
      typical webpage viewing windows, so some examples need to be broken
      in places where there is no whitespace.  I've added &zwsp; markers in
      suitable places to allow the tables to render warning-free in PDF.
      
      I've so far converted only the date/time operator, date/time function,
      and enum function tables in sections 9.9 and 9.10; these were chosen
      to provide a reasonable sample of the formatting problems that need
      to be solved.  Assuming that this looks good on the website and doesn't
      provoke howls of anguish, I'll work on the other similar tables in the
      near future.
      
      There's a moderate amount of new editorial content in this patch along
      with the raw formatting changes; for instance I had to write text
      descriptions for operators that lacked them.  I failed to resist the
      temptation to improve some other descriptions and examples, too.
      
      Patch by me, with thanks to Alexander Lakhin for assistance with
      figuring out some formatting issues.
      
      Discussion: https://postgr.es/m/9326.1581457869@sss.pgh.pa.us
      e894c618
    • Tom Lane's avatar
      Doc: introduce and document "&zwsp;" for allowing optional line breaks. · 88d934f0
      Tom Lane authored
      We already had a couple of places using zero-width spaces for formatting
      hackery, and we're going to need more if we ever want the PDF manuals to
      look decent.  But please let's not write hard-coded Unicode escapes.
      We can avoid that by using a custom entity, which also provides a place
      to put a teeny bit of documentation about what it is and how to use it.
      
      I'd previously posted a patch using "&break;" for this, but on reflection
      that would be horrible to grep for.  Instead let's use "&zwsp;", based
      on the name of the Unicode symbol ("zero width space").
      
      Discussion: https://postgr.es/m/9326.1581457869@sss.pgh.pa.us
      88d934f0
    • Robert Haas's avatar
      Rename pg_validatebackup to pg_verifybackup. · dbc60c55
      Robert Haas authored
      Also, use "verify" rather than "validate" to refer to the process
      being undertaken here. Per discussion, that is a more appropriate
      term.
      
      Discussion: https://www.postgresql.org/message-id/172c9d9b-1d0a-1b94-1456-376b1e017322@2ndquadrant.com
      Discussion: http://postgr.es/m/CA+TgmobLgMh6p8FmLbj_rv9Uhd7tPrLnAyLgGd2SoSj=qD-bVg@mail.gmail.com
      dbc60c55
    • Peter Geoghegan's avatar
      Doc: Fix contrib/amcheck tip. · 26640c40
      Peter Geoghegan authored
      Fixes an oversight in commit 20fbb711.
      26640c40
  7. 11 Apr, 2020 3 commits