1. 24 Sep, 2020 6 commits
    • Robert Haas's avatar
      Fix two bugs in MaintainOldSnapshotTimeMapping. · 55b7e2f4
      Robert Haas authored
      The previous coding was confused about whether head_timestamp was
      intended to represent the timestamp for the newest bucket in the
      mapping or the oldest timestamp for the oldest bucket in the mapping.
      Decide that it's intended to be the oldest one, and repair
      accordingly.
      
      To do that, we need to do two things. First, when advancing to a
      new bucket, don't categorically set head_timestamp to the new
      timestamp. Do this only if we're blowing out the map completely
      because a lot of time has passed since we last maintained it. If
      we're replacing entries one by one, advance head_timestamp by
      1 minute for each; if we're filling in unused entries, don't
      advance head_timestamp at all.
      
      Second, fix the computation of how many buckets we need to advance.
      The previous formula would be correct if head_timestamp were the
      timestamp for the new bucket, but we're now making all the code
      agree that it's the timestamp for the oldest bucket, so adjust the
      formula accordingly.
      
      This is certainly a bug fix, but I don't feel good about
      back-patching it without the introspection tools added by commit
      aecf5ee2, and perhaps also some
      actual tests. Since back-patching the introspection tools might
      not attract sufficient support and since there are no automated
      tests of these fixes yet, I'm just committing this to master for
      now.
      
      Patch by me, reviewed by Thomas Munro, Dilip Kumar, Hamid Akhtar.
      
      Discussion: http://postgr.es/m/CA+TgmoY=aqf0zjTD+3dUWYkgMiNDegDLFjo+6ze=Wtpik+3XqA@mail.gmail.com
      55b7e2f4
    • Peter Eisentraut's avatar
      Standardize the printf format for st_size · c005eb00
      Peter Eisentraut authored
      Existing code used various inconsistent ways to printf struct stat's
      st_size member.  The type of that is off_t, which is in most cases a
      signed 64-bit integer, so use the long long int format for it.
      c005eb00
    • Robert Haas's avatar
      Add new 'old_snapshot' contrib module. · aecf5ee2
      Robert Haas authored
      You can use this to view the contents of the time to XID mapping
      which the server maintains when old_snapshot_threshold != -1.
      Being able to view that information may be interesting for users,
      and it's definitely useful for figuring out whether the mapping
      is being maintained correctly. It isn't, so that will need to be
      fixed in a subsequent commit.
      
      Patch by me, reviewed by Thomas Munro, Dilip Kumar, Hamid Akhtar.
      
      Discussion: http://postgr.es/m/CA+TgmoY=aqf0zjTD+3dUWYkgMiNDegDLFjo+6ze=Wtpik+3XqA@mail.gmail.com
      aecf5ee2
    • Robert Haas's avatar
      Expose oldSnapshotControl definition via new header. · f5ea92e8
      Robert Haas authored
      This makes it possible for code outside snapmgr.c to examine the
      contents of this data structure. This commit does not add any code
      which actually does so; a subsequent commit will make that change.
      
      Patch by me, reviewed by Thomas Munro, Dilip Kumar, Hamid Akhtar.
      
      Discussion: http://postgr.es/m/CA+TgmoY=aqf0zjTD+3dUWYkgMiNDegDLFjo+6ze=Wtpik+3XqA@mail.gmail.com
      f5ea92e8
    • Tom Lane's avatar
    • Tom Lane's avatar
      Improve behavior of tsearch_readline(), and remove t_readline(). · 83b61319
      Tom Lane authored
      Commit fbeb9da2, which added the tsearch_readline APIs, left
      t_readline() in place as a compatibility measure.  But that function
      has been unused and deprecated for twelve years now, so that seems
      like enough time to remove it.  Doing so, and merging t_readline's
      code into tsearch_readline, aids in making several useful
      improvements:
      
      * The hard-wired 4K limit on line length in tsearch data files is
      removed, by using a StringInfo buffer instead of a fixed-size buffer.
      
      * We can buy back the per-line palloc/pfree added by 3ea7e955
      in the common case where encoding conversion is not required.
      
      * We no longer need a separate pg_verify_mbstr call, as that
      functionality was folded into encoding conversion some time ago.
      
      (We could have done some of this stuff while keeping t_readline as a
      separate API, but there seems little point, since there's no reason
      for anyone to still be using t_readline directly.)
      
      Discussion: https://postgr.es/m/48A4FA71-524E-41B9-953A-FD04EF36E2E7@yesql.se
      83b61319
  2. 23 Sep, 2020 4 commits
  3. 22 Sep, 2020 5 commits
  4. 21 Sep, 2020 4 commits
  5. 20 Sep, 2020 2 commits
  6. 19 Sep, 2020 3 commits
  7. 18 Sep, 2020 6 commits
  8. 17 Sep, 2020 10 commits
    • Tom Lane's avatar
      Remove support for postfix (right-unary) operators. · 1ed6b895
      Tom Lane authored
      This feature has been a thorn in our sides for a long time, causing
      many grammatical ambiguity problems.  It doesn't seem worth the
      pain to continue to support it, so remove it.
      
      There are some follow-on improvements we can make in the grammar,
      but this commit only removes the bare minimum number of productions,
      plus assorted backend support code.
      
      Note that pg_dump and psql continue to have full support, since
      they may be used against older servers.  However, pg_dump warns
      about postfix operators.  There is also a check in pg_upgrade.
      
      Documentation-wise, I (tgl) largely removed the "left unary"
      terminology in favor of saying "prefix operator", which is
      a more standard and IMO less confusing term.
      
      I included a catversion bump, although no initial catalog data
      changes here, to mark the boundary at which oprkind = 'r'
      stopped being valid in pg_operator.
      
      Mark Dilger, based on work by myself and Robert Haas;
      review by John Naylor
      
      Discussion: https://postgr.es/m/38ca86db-42ab-9b48-2902-337a0d6b8311@2ndquadrant.com
      1ed6b895
    • Tom Lane's avatar
      Remove factorial operators, leaving only the factorial() function. · 76f412ab
      Tom Lane authored
      The "!" operator is our only built-in postfix operator.  Remove it,
      on the way to removal of grammar support for postfix operators.
      
      There is also a "!!" prefix operator, but since it's been marked
      deprecated for most of its existence, we might as well remove it too.
      
      Also zap the SQL alias function numeric_fac(), which seems to have
      equally little reason to live.
      
      Mark Dilger, based on work by myself and Robert Haas;
      review by John Naylor
      
      Discussion: https://postgr.es/m/38ca86db-42ab-9b48-2902-337a0d6b8311@2ndquadrant.com
      76f412ab
    • Tom Lane's avatar
      Further improve pgindent's list of file exclusions. · 74d4608f
      Tom Lane authored
      I despair of people keeping the README file's notes in sync with
      the actual exclusion list, so move the notes into the exclusion file.
      Adjust the pgindent script to explicitly ignore comments in the file,
      just in case (though it's hard to believe any would match filenames).
      
      Extend the list so that it doesn't process any files we'd not wish it to
      even in a fully-built-out development directory.  (There are still a
      couple of derived files that it wants to reformat, but fixing the
      generator scripts for those seems like fit material for a separate patch.)
      
      Discussion: https://postgr.es/m/79ed5348-be7a-b647-dd40-742207186a22@2ndquadrant.com
      74d4608f
    • Tom Lane's avatar
      Improve common/logging.c's support for multiple verbosity levels. · 99175141
      Tom Lane authored
      Instead of hard-wiring specific verbosity levels into the option
      processing of client applications, invent pg_logging_increase_verbosity()
      and encourage clients to implement --verbose by calling that.  Then,
      the common convention that more -v's gets you more verbosity just works.
      
      In particular, this allows resurrection of the debug-grade messages that
      have long existed in pg_dump and its siblings.  They were unreachable
      before this commit due to lack of a way to select PG_LOG_DEBUG logging
      level.  (It appears that they may have been unreachable for some time
      before common/logging.c was introduced, too, so I'm not specifically
      blaming cc8d4151 for the oversight.  One reason for thinking that is
      that it's now apparent that _allocAH()'s message needs a null-pointer
      guard.  Testing might have failed to reveal that before 96bf88d5.)
      
      Discussion: https://postgr.es/m/1173106.1600116625@sss.pgh.pa.us
      99175141
    • Amit Kapila's avatar
      Update parallel BTree scan state when the scan keys can't be satisfied. · b7f2dd95
      Amit Kapila authored
      For parallel btree scan to work for array of scan keys, it should reach
      BTPARALLEL_DONE state once for every distinct combination of array keys.
      This is required to ensure that the parallel workers don't try to seize
      blocks at the same time for different scan keys. We missed to update this
      state when we discovered that the scan keys can't be satisfied.
      
      Author: James Hunter
      Reviewed-by: Amit Kapila
      Tested-by: Justin Pryzby
      Backpatch-through: 10, where it was introduced
      Discussion: https://postgr.es/m/4248CABC-25E3-4809-B4D0-128E1BAABC3C@amazon.com
      b7f2dd95
    • Peter Eisentraut's avatar
      Allow CURRENT_ROLE where CURRENT_USER is accepted · 45b98057
      Peter Eisentraut authored
      In the particular case of GRANTED BY, this is specified in the SQL
      standard.  Since in PostgreSQL, CURRENT_ROLE is equivalent to
      CURRENT_USER, and CURRENT_USER is already supported here, adding
      CURRENT_ROLE is trivial.  The other cases are PostgreSQL extensions,
      but for the same reason it also makes sense there.
      Reviewed-by: default avatarVik Fearing <vik@postgresfriends.org>
      Reviewed-by: default avatarAsif Rehman <asifr.rehman@gmail.com>
      Reviewed-by: default avatarAlvaro Herrera <alvherre@2ndquadrant.com>
      Discussion: https://www.postgresql.org/message-id/flat/f2feac44-b4c5-f38f-3699-2851d6a76dc9%402ndquadrant.com
      45b98057
    • Heikki Linnakangas's avatar
      Add support for building GiST index by sorting. · 16fa9b2b
      Heikki Linnakangas authored
      This adds a new optional support function to the GiST access method:
      sortsupport. If it is defined, the GiST index is built by sorting all data
      to the order defined by the sortsupport's comparator function, and packing
      the tuples in that order to GiST pages. This is similar to how B-tree
      index build works, and is much faster than inserting the tuples one by
      one. The resulting index is smaller too, because the pages are packed more
      tightly, upto 'fillfactor'. The normal build method works by splitting
      pages, which tends to lead to more wasted space.
      
      The quality of the resulting index depends on how good the opclass-defined
      sort order is. A good order preserves locality of the input data.
      
      As the first user of this facility, add 'sortsupport' function to the
      point_ops opclass. It sorts the points in Z-order (aka Morton Code), by
      interleaving the bits of the X and Y coordinates.
      
      Author: Andrey Borodin
      Reviewed-by: Pavel Borisov, Thomas Munro
      Discussion: https://www.postgresql.org/message-id/1A36620E-CAD8-4267-9067-FB31385E7C0D%40yandex-team.ru
      16fa9b2b
    • Michael Paquier's avatar
      doc: Apply more consistently <productname> markup for OpenSSL · 089da3c4
      Michael Paquier authored
      OpenSSL was quoted in inconsistent ways in many places of the docs,
      sometimes with <application>, <productname> or just nothing.
      
      Author: Daniel Gustafsson
      Discussion: https://postgr.es/m/DA91E5F0-5F9D-41A7-A7A6-B91CDE0F1D63@yesql.se
      089da3c4
    • Michael Paquier's avatar
      Improve tab completion of IMPORT FOREIGN SCHEMA in psql · 7307df16
      Michael Paquier authored
      It is not possible to get a list of foreign schemas as the server is not
      known, so this provides instead a list of local schemas, which is more
      useful than nothing if using a loopback server or having schema names
      matching in the local and remote servers.
      
      Author: Jeff Janes
      Reviewed-by: Tom Lane, Michael Paquier
      Discussion: https://postgr.es/m/CAMkU=1wr7Roj41q-XiJs=Uyc2xCmHhcGGy7J-peJQK-e+w=ghw@mail.gmail.com
      7307df16
    • Tom Lane's avatar
      Teach walsender to update its process title for replication commands. · babef40c
      Tom Lane authored
      Because the code path taken for SQL commands executed in a walsender
      will update the process title, we pretty much have to update the
      title for replication commands as well.  Otherwise, the title shows
      "idle" for the rest of a logical walsender's lifetime once it's
      executed any SQL command.
      
      Playing with this, I confirm that a walsender now typically spends
      most of its life reporting
      	walsender postgres [local] START_REPLICATION
      Considering this in isolation, it might be better to have it say
      	walsender postgres [local] sending replication data
      However, consistency with the other cases seems to be a stronger
      argument.
      
      In passing, remove duplicative pgstat_report_activity call.
      
      Discussion: https://postgr.es/m/880181.1600026471@sss.pgh.pa.us
      babef40c