1. 21 Jan, 2021 2 commits
  2. 20 Jan, 2021 8 commits
    • Tomas Vondra's avatar
      Implement support for bulk inserts in postgres_fdw · b663a413
      Tomas Vondra authored
      Extends the FDW API to allow batching inserts into foreign tables. That
      is usually much more efficient than inserting individual rows, due to
      high latency for each round-trip to the foreign server.
      
      It was possible to implement something similar in the regular FDW API,
      but it was inconvenient and there were issues with reporting the number
      of actually inserted rows etc. This extends the FDW API with two new
      functions:
      
      * GetForeignModifyBatchSize - allows the FDW picking optimal batch size
      
      * ExecForeignBatchInsert - inserts a batch of rows at once
      
      Currently, only INSERT queries support batching. Support for DELETE and
      UPDATE may be added in the future.
      
      This also implements batching for postgres_fdw. The batch size may be
      specified using "batch_size" option both at the server and table level.
      
      The initial patch version was written by me, but it was rewritten and
      improved in many ways by Takayuki Tsunakawa.
      
      Author: Takayuki Tsunakawa
      Reviewed-by: Tomas Vondra, Amit Langote
      Discussion: https://postgr.es/m/20200628151002.7x5laxwpgvkyiu3q@development
      b663a413
    • Tomas Vondra's avatar
      psql \dX: list extended statistics objects · ad600bba
      Tomas Vondra authored
      The new command lists extended statistics objects. All past releases
      with extended statistics are supported.
      
      This is a simplified version of commit 891a1d0b, which had to be
      reverted due to not considering pg_statistic_ext_data is not accessible
      by regular users. Fields requiring access to this catalog were removed.
      It's possible to add them, but it'll require changes to core.
      
      Author: Tatsuro Yamada
      Reviewed-by: Julien Rouhaud, Alvaro Herrera, Tomas Vondra, Noriyoshi Shinoda
      Discussion: https://postgr.es/m/c027a541-5856-75a5-0868-341301e1624b%40nttcom.co.jp_1
      ad600bba
    • Tom Lane's avatar
      Further tweaking of PG_SYSROOT heuristics for macOS. · 9d23c15a
      Tom Lane authored
      It emerges that in some phases of the moon (perhaps to do with
      directory entry order?), xcrun will report that the SDK path is
        /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
      which is normally a symlink to a version-numbered sibling directory.
      Our heuristic to skip non-version-numbered pathnames was rejecting
      that, which is the wrong thing to do.  We'd still like to end up
      with a version-numbered PG_SYSROOT value, but we can have that by
      dereferencing the symlink.
      
      Like the previous fix, back-patch to all supported versions.
      
      Discussion: https://postgr.es/m/522433.1611089678@sss.pgh.pa.us
      9d23c15a
    • Tom Lane's avatar
      Disable vacuum page skipping in selected test cases. · c2dc1a79
      Tom Lane authored
      By default VACUUM will skip pages that it can't immediately get
      exclusive access to, which means that even activities as harmless
      and unpredictable as checkpoint buffer writes might prevent a page
      from being processed.  Ordinarily this is no big deal, but we have
      a small number of test cases that examine the results of VACUUM's
      processing and therefore will fail if the page of interest is skipped.
      This seems to be the explanation for some rare buildfarm failures.
      To fix, add the DISABLE_PAGE_SKIPPING option to the VACUUM commands
      in tests where this could be an issue.
      
      In passing, remove a duplicated query in pageinspect/sql/page.sql.
      
      Back-patch as necessary (some of these cases are as old as v10).
      
      Discussion: https://postgr.es/m/413923.1611006484@sss.pgh.pa.us
      c2dc1a79
    • Heikki Linnakangas's avatar
      Fix bug in detecting concurrent page splits in GiST insert · 6b4d3046
      Heikki Linnakangas authored
      In commit 9eb5607e, I got the condition on checking for split or
      deleted page wrong: I used && instead of ||. The comment correctly said
      "concurrent split _or_ deletion".
      
      As a result, GiST insertion could miss a concurrent split, and insert to
      wrong page. Duncan Sands demonstrated this with a test script that did a
      lot of concurrent inserts.
      
      Backpatch to v12, where this was introduced. REINDEX is required to fix
      indexes that were affected by this bug.
      
      Backpatch-through: 12
      Reported-by: Duncan Sands
      Discussion: https://www.postgresql.org/message-id/a9690483-6c6c-3c82-c8ba-dc1a40848f11%40deepbluecap.com
      6b4d3046
    • Thomas Munro's avatar
      Fix sample output of EXPLAIN ANALYZE. · 679744cf
      Thomas Munro authored
      Since commit f0f13a3a, we estimate
      ModifyTable paths without a RETURNING clause differently.  Update an
      example from the manual that showed the old behavior.
      
      Author: Takayuki Tsunakawa <tsunakawa.takay@fujitsu.com>
      Reviewed-by: default avatarLaurenz Albe <laurenz.albe@cybertec.at>
      Discussion: https://postgr.es/m/TYAPR01MB29905674F41693BBA9DA28CAFEA20%40TYAPR01MB2990.jpnprd01.prod.outlook.com
      679744cf
    • Michael Paquier's avatar
      Add regression test for DROP OWNED BY with default ACLs · a36dc04d
      Michael Paquier authored
      DROP OWNED BY has a specific code path to remove ACLs stored in
      pg_default_acl when cleaning up shared dependencies that had no
      coverage with the existing tests.  This issue has been found while
      digging into the bug fixed by 21378e1f.
      
      As ALTER DEFAULT PRIVILEGES impacts the ACLs of all objects created
      while the default permissions are visible, the test uses a transaction
      rollback to isolate the test and avoid any impact with other sessions
      running in parallel.
      
      Reviewed-by: Álvaro Herrera
      Discussion: https://postgr.es/m/YAbQ1OD+3ip4lRv8@paquier.xyz
      a36dc04d
    • Michael Paquier's avatar
      Fix ALTER DEFAULT PRIVILEGES with duplicated objects · 21378e1f
      Michael Paquier authored
      Specifying duplicated objects in this command would lead to unique
      constraint violations in pg_default_acl or "tuple already updated by
      self" errors.  Similarly to GRANT/REVOKE, increment the command ID after
      each subcommand processing to allow this case to work transparently.
      
      A regression test is added by tweaking one of the existing queries of
      privileges.sql to stress this case.
      
      Reported-by: Andrus
      Author: Michael Paquier
      Reviewed-by: Álvaro Herrera
      Discussion: https://postgr.es/m/ae2a7dc1-9d71-8cba-3bb9-e4cb7eb1f44e@hot.ee
      Backpatch-through: 9.5
      21378e1f
  3. 19 Jan, 2021 4 commits
  4. 18 Jan, 2021 10 commits
  5. 17 Jan, 2021 7 commits
  6. 16 Jan, 2021 5 commits
  7. 15 Jan, 2021 4 commits
    • Tomas Vondra's avatar
      Disallow CREATE STATISTICS on system catalogs · c9a0dc34
      Tomas Vondra authored
      Add a check that CREATE STATISTICS does not add extended statistics on
      system catalogs, similarly to indexes etc.  It can be overriden using
      the allow_system_table_mods GUC.
      
      This bug exists since 7b504eb2, adding the extended statistics, so
      backpatch all the way back to PostgreSQL 10.
      
      Author: Tomas Vondra
      Reported-by: Dean Rasheed
      Backpatch-through: 10
      Discussion: https://postgr.es/m/CAEZATCXAPrrOKwEsyZKQ4uzzJQWBCt6QAvOcgqRGdWwT1zb%2BrQ%40mail.gmail.com
      c9a0dc34
    • Tom Lane's avatar
      Improve our heuristic for selecting PG_SYSROOT on macOS. · 4823621d
      Tom Lane authored
      In cases where Xcode is newer than the underlying macOS version,
      asking xcodebuild for the SDK path will produce a pointer to the
      SDK shipped with Xcode, which may end up building code that does
      not work on the underlying macOS version.  It appears that in
      such cases, xcodebuild's answer also fails to match the default
      behavior of Apple's compiler: assuming one has installed Xcode's
      "command line tools", there will be an SDK for the OS's own version
      in /Library/Developer/CommandLineTools, and the compiler will
      default to using that.  This is all pretty poorly documented,
      but experimentation suggests that "xcrun --show-sdk-path" gives
      the sysroot path that the compiler is actually using, at least
      in some cases.  Hence, try that first, but revert to xcodebuild
      if xcrun fails (in very old Xcode, it is missing or lacks the
      --show-sdk-path switch).
      
      Also, "xcrun --show-sdk-path" may give a path that is valid but lacks
      any OS version identifier.  We don't really want that, since most
      of the motivation for wiring -isysroot into the build flags at all
      is to ensure that all parts of a PG installation are built against
      the same SDK, even when considering extensions built later and/or on
      a different machine.  Insist on finding "N.N" in the directory name
      before accepting the result.  (Adding "--sdk macosx" to the xcrun
      call seems to produce the same answer as xcodebuild, but usually
      more quickly because it's cached, so we also try that as a fallback.)
      
      The core reason why we don't want to use Xcode's default SDK in cases
      like this is that Apple's technology for introducing new syscalls
      does not play nice with Autoconf: for example, configure will think
      that preadv/pwritev exist when using a Big Sur SDK, even when building
      on an older macOS version where they don't exist.  It'd be nice to
      have a better solution to that problem, but this patch doesn't attempt
      to fix that.
      
      Per report from Sergey Shinderuk.  Back-patch to all supported versions.
      
      Discussion: https://postgr.es/m/ed3b8e5d-0da8-6ebd-fd1c-e0ac80a4b204@postgrespro.ru
      4823621d
    • Alvaro Herrera's avatar
      Avoid spurious wait in concurrent reindex · f9900df5
      Alvaro Herrera authored
      This is like commit c98763bf, but for REINDEX CONCURRENTLY.  To wit:
      this flags indicates that the current process is safe to ignore for the
      purposes of waiting for other snapshots, when doing CREATE INDEX
      CONCURRENTLY and REINDEX CONCURRENTLY.  This helps two processes doing
      either of those things not deadlock, and also avoids spurious waits.
      
      Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
      Reviewed-by: default avatarDmitry Dolgov <9erthalion6@gmail.com>
      Reviewed-by: default avatarHamid Akhtar <hamid.akhtar@gmail.com>
      Reviewed-by: default avatarMasahiko Sawada <sawada.mshk@gmail.com>
      Discussion: https://postgr.es/m/20201130195439.GA24598@alvherre.pgsql
      f9900df5
    • Fujii Masao's avatar
      Fix calculation of how much shared memory is required to store a TOC. · 2ad78a87
      Fujii Masao authored
      Commit ac883ac4 refactored shm_toc_estimate() but changed its calculation
      of shared memory size for TOC incorrectly. Previously this could cause too
      large memory to be allocated.
      
      Back-patch to v11 where the bug was introduced.
      
      Author: Takayuki Tsunakawa
      Discussion: https://postgr.es/m/TYAPR01MB2990BFB73170E2C4921E2C4DFEA80@TYAPR01MB2990.jpnprd01.prod.outlook.com
      2ad78a87