1. 24 Jan, 2021 3 commits
  2. 23 Jan, 2021 4 commits
  3. 22 Jan, 2021 8 commits
  4. 21 Jan, 2021 4 commits
    • Tom Lane's avatar
      Improve new wording of libpq's connection failure messages. · 27a48e5a
      Tom Lane authored
      "connection to server so-and-so failed:" seems clearer than the
      previous wording "could not connect to so-and-so:" (introduced by
      52a10224), because the latter suggests a network-level connection
      failure.  We're now prefixing this string to all types of connection
      failures, for instance authentication failures; so we need wording
      that doesn't imply a low-level error.
      
      Per discussion with Robert Haas.
      
      Discussion: https://postgr.es/m/CA+TgmobssJ6rS22dspWnu-oDxXevGmhMD8VcRBjmj-b9UDqRjw@mail.gmail.com
      27a48e5a
    • Tom Lane's avatar
      Fix pull_varnos' miscomputation of relids set for a PlaceHolderVar. · 55dc86ec
      Tom Lane authored
      Previously, pull_varnos() took the relids of a PlaceHolderVar as being
      equal to the relids in its contents, but that fails to account for the
      possibility that we have to postpone evaluation of the PHV due to outer
      joins.  This could result in a malformed plan.  The known cases end up
      triggering the "failed to assign all NestLoopParams to plan nodes"
      sanity check in createplan.c, but other symptoms may be possible.
      
      The right value to use is the join level we actually intend to evaluate
      the PHV at.  We can get that from the ph_eval_at field of the associated
      PlaceHolderInfo.  However, there are some places that call pull_varnos()
      before the PlaceHolderInfos have been created; in that case, fall back
      to the conservative assumption that the PHV will be evaluated at its
      syntactic level.  (In principle this might result in missing some legal
      optimization, but I'm not aware of any cases where it's an issue in
      practice.)  Things are also a bit ticklish for calls occurring during
      deconstruct_jointree(), but AFAICS the ph_eval_at fields should have
      reached their final values by the time we need them.
      
      The main problem in making this work is that pull_varnos() has no
      way to get at the PlaceHolderInfos.  We can fix that easily, if a
      bit tediously, in HEAD by passing it the planner "root" pointer.
      In the back branches that'd cause an unacceptable API/ABI break for
      extensions, so leave the existing entry points alone and add new ones
      with the additional parameter.  (If an old entry point is called and
      encounters a PHV, it'll fall back to using the syntactic level,
      again possibly missing some valid optimization.)
      
      Back-patch to v12.  The computation is surely also wrong before that,
      but it appears that we cannot reach a bad plan thanks to join order
      restrictions imposed on the subquery that the PlaceHolderVar came from.
      The error only became reachable when commit 4be058fe allowed trivial
      subqueries to be collapsed out completely, eliminating their join order
      restrictions.
      
      Per report from Stephan Springl.
      
      Discussion: https://postgr.es/m/171041.1610849523@sss.pgh.pa.us
      55dc86ec
    • Tomas Vondra's avatar
      Fix initialization of FDW batching in ExecInitModifyTable · 920f853d
      Tomas Vondra authored
      ExecInitModifyTable has to initialize batching for all result relations,
      not just the first one. Furthermore, when junk filters were necessary,
      the pointer pointed past the mtstate->resultRelInfo array.
      
      Per reports from multiple non-x86 animals (florican, locust, ...).
      
      Discussion: https://postgr.es/m/20200628151002.7x5laxwpgvkyiu3q@development
      920f853d
    • Michael Paquier's avatar
      Switch "cl /?" to "cl /help" in MSVC scripts for platform detection · 733d6700
      Michael Paquier authored
      "cl /?" produces a different output if run on a real or a virtual drive
      (this can be set with a simple subst command), causing an error in the
      MSVC scripts if building on a virtual drive because the platform to use
      cannot be detected.
      
      "cl /help", on the contrary, produces a consistent output if used on a
      real or virtual drive.  Changing to "/help" allows the compilation to
      work with a virtual drive as long as the top of the code repository is
      part of the drive, without impacting the build on real drives.
      
      Reported-by: Robert Grange
      Author: Juan José Santamaría Flecha
      Discussion: https://postgr.es/m/16825-c4f104bcebc67034@postgresql.org
      733d6700
  5. 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
  6. 19 Jan, 2021 4 commits
  7. 18 Jan, 2021 9 commits