1. 16 Nov, 2019 3 commits
    • Michael Paquier's avatar
      Improve stability of tests for VACUUM (SKIP_LOCKED) · 3db0598d
      Michael Paquier authored
      Concurrent autovacuums running with the main regression test suite
      could cause the tests with VACUUM (SKIP_LOCKED) to generate randomly
      WARNING messages.  For these tests, set client_min_messages to ERROR to
      get rid of those random failures, as disabling autovacuum for the
      relations operated would not completely close the failure window.
      
      For isolation tests, disable autovacuum for the relations vacuumed with
      SKIP_LOCKED.  The tests are designed so as LOCK commands are taken
      in a first session before running a concurrent VACUUM (SKIP_LOCKED) in a
      second to generate WARNING messages, but a concurrent autovacuum could
      cause the tests to be slower.
      
      Reported-by: Tom Lane
      Author: Michael Paquier
      Reviewed-by: Andres Freund, Tom Lane
      Discussion: https://postgr.es/m/25294.1573077278@sss.pgh.pa.us
      Backpatch-through: 12
      3db0598d
    • Tomas Vondra's avatar
      Properly determine length for on-disk TOAST values · 2dc08bd6
      Tomas Vondra authored
      In detoast_attr_slice, VARSIZE_ANY was used to compute compressed length
      of on-disk TOAST values. That's incorrect, because the varlena value may
      be just a TOAST pointer, producing either bogus value or crashing.
      
      This is likely why the code was crashing on big-endian machines before
      540f3168 replaced the VARSIZE with VARSIZE_ANY, which however only
      masked the issue.
      
      Reported-by: Rushabh Lathia
      Discussion: https://postgr.es/m/CAL-OGkthU9Gs7TZchf5OWaL-Gsi=hXqufTxKv9qpNG73d5na_g@mail.gmail.com
      2dc08bd6
    • Tomas Vondra's avatar
      Skip system attributes when applying mvdistinct stats · d482f7f8
      Tomas Vondra authored
      When estimating number of distinct groups, we failed to ignore system
      attributes when matching the group expressions to mvdistinct stats,
      causing failures like
      
        ERROR: negative bitmapset member not allowed
      
      Fix that by simply skipping anything that is not a regular attribute.
      Backpatch to PostgreSQL 10, where the extended stats were introduced.
      
      Bug: #16111
      Reported-by: Tuomas Leikola
      Author: Tomas Vondra
      Backpatch-through: 10
      Discussion: https://postgr.es/m/16111-687799584c3a7e73@postgresql.org
      d482f7f8
  2. 15 Nov, 2019 1 commit
  3. 14 Nov, 2019 4 commits
  4. 13 Nov, 2019 11 commits
    • Andres Freund's avatar
      Remove unused code from tuplesort. · 7d962eaf
      Andres Freund authored
      copytup_index() is unused, as tuplesort_putindextuplevalues() doesn't
      use COPYTUP(). Replace function body with an elog(ERROR), as already
      done e.g. for copytup_datum().
      
      Author: Andres Freund
      Discussion: https://postgr.es/m/20191013144153.ooxrfglvnaocsrx2@alap3.anarazel.de
      7d962eaf
    • Andres Freund's avatar
      Add tests for tuplesort.c. · 4a252996
      Andres Freund authored
      Previously significant parts of tuplesort.c were untested. This
      commit, while not testing every path, significantly increases
      coverage.  In particular, this adds tests for abbreviated key logic,
      forward/backward scans & scrolling and mark/restore.
      
      I tried to keep the table sizes reasonable, and stress the on-disk
      paths by setting work_mem to low values for specific tests. The
      buildfarm will tell whether more attention to test time is needed.
      
      Author: Andres Freund
      Discussion: https://postgr.es/m/20191013144153.ooxrfglvnaocsrx2@alap3.anarazel.de
      4a252996
    • Tom Lane's avatar
      Add missing check_collation_set call to bpcharne(). · d57d6153
      Tom Lane authored
      We should throw an error for indeterminate collation, but bpcharne()
      was missing that logic, resulting in a much less user-friendly error
      (either an assertion failure or "cache lookup failed for collation 0").
      
      Per report from Manuel Rigger.  Back-patch to v12 where the mistake
      came in, evidently in commit 5e1963fb.  (Before non-deterministic
      collations, this function wasn't collation sensitive.)
      
      Discussion: https://postgr.es/m/CA+u7OA4HOjtymxAbuGNh4-X_2R0Lw5n01tzvP8E5-i-2gQXYWA@mail.gmail.com
      d57d6153
    • Tom Lane's avatar
      Fix silly initializations (cosmetic only). · 0cafdd03
      Tom Lane authored
      Initializing a pointer to "false" isn't per project style,
      and reportedly some compilers warn about it (though I've
      not seen any such warnings in the buildfarm).
      
      Seems to have come in with commit ff11e7f4, so back-patch
      to v12 where that was added.
      
      Didier Gautheron
      
      Discussion: https://postgr.es/m/CAJRYxu+XQuM0qnSqt1Ujztu6fBPzMMAT3VEn6W32rgKG6A2Fsw@mail.gmail.com
      0cafdd03
    • Tom Lane's avatar
      Avoid using SplitIdentifierString to parse ListenAddresses, too. · 7bf40ea0
      Tom Lane authored
      This gets rid of our former behavior of forcibly downcasing
      the postmaster's hostname list and truncating the elements to
      NAMEDATALEN.  In principle, DNS hostnames are case-insensitive
      so the first behavior should be harmless, and server hostnames
      are seldom long enough for the second behavior to be an issue.
      But it's still dubious, and an easy fix is available: just use
      SplitGUCList instead.
      
      AFAICT, all other SplitIdentifierString calls in the backend are
      OK: either the items actually are SQL identifiers, or they are
      keywords that are short and case-insensitive.
      
      Per thinking about bug #16106.  While this has been wrong for
      a very long time, the lack of field complaints means there's
      little reason to back-patch.
      
      Discussion: https://postgr.es/m/16106-7d319e4295d08e70@postgresql.org
      7bf40ea0
    • Tom Lane's avatar
      Avoid downcasing/truncation of RADIUS authentication parameters. · 7618eaf5
      Tom Lane authored
      Commit 6b76f1bb changed all the RADIUS auth parameters to be lists
      rather than single values.  But its use of SplitIdentifierString
      to parse the list format was not very carefully thought through,
      because that function thinks it's parsing SQL identifiers, which
      means it will (a) downcase the strings and (b) truncate them to
      be shorter than NAMEDATALEN.  While downcasing should be harmless
      for the server names and ports, it's just wrong for the shared
      secrets, and probably for the NAS Identifier strings as well.
      The truncation aspect is at least potentially a problem too,
      though typical values for these parameters would fit in 63 bytes.
      
      Fortunately, we now have a function SplitGUCList that is exactly
      the same except for not doing the two unwanted things, so fixing
      this is a trivial matter of calling that function instead.
      
      While here, improve the documentation to show how to double-quote
      the parameter values.  I failed to resist the temptation to do
      some copy-editing as well.
      
      Report and patch from Marcos David (bug #16106); doc changes by me.
      Back-patch to v10 where the aforesaid commit came in, since this is
      arguably a regression from our previous behavior with RADIUS auth.
      
      Discussion: https://postgr.es/m/16106-7d319e4295d08e70@postgresql.org
      7618eaf5
    • Tom Lane's avatar
      Include TableFunc references when computing expression dependencies. · 2c7b5dad
      Tom Lane authored
      The TableFunc node (i.e., XMLTABLE) includes type and collation OIDs
      that might not be referenced anywhere else in the expression tree,
      so they need to be accounted for when extracting dependencies.
      
      Fortunately, the practical effects of this are limited, since
      (a) it's somewhat unlikely that people would be extracting
      columns of non-builtin types from an XML document, and (b)
      in many scenarios, the query would contain other references
      to such types, or functions depending on them.  However, it's
      not hard to construct examples wherein the existing code lets
      one drop a type used in XMLTABLE and thereby break a view.
      
      This is evidently an original oversight in the XMLTABLE patch,
      so back-patch to v10 where that came in.
      
      Discussion: https://postgr.es/m/18427.1573508501@sss.pgh.pa.us
      2c7b5dad
    • Tom Lane's avatar
      Handle arrays and ranges in pg_upgrade's test for non-upgradable types. · 29aeda6e
      Tom Lane authored
      pg_upgrade needs to check whether certain non-upgradable data types
      appear anywhere on-disk in the source cluster.  It knew that it has
      to check for these types being contained inside domains and composite
      types; but it somehow overlooked that they could be contained in
      arrays and ranges, too.  Extend the existing recursive-containment
      query to handle those cases.
      
      We probably should have noticed this oversight while working on
      commit 0ccfc282 and follow-ups, but we failed to :-(.  The whole
      thing's possibly a bit overdesigned, since we don't really expect
      that any of these types will appear on disk; but if we're going to
      the effort of doing a recursive search then it's silly not to cover
      all the possibilities.
      
      While at it, refactor so that we have only one copy of the search
      logic, not three-and-counting.  Also, to keep the branches looking
      more alike, back-patch the output wording change of commit 1634d361.
      
      Back-patch to all supported branches.
      
      Discussion: https://postgr.es/m/31473.1573412838@sss.pgh.pa.us
      29aeda6e
    • Fujii Masao's avatar
      Make pg_waldump report more detail information about PREPARE TRANSACTION record. · 7b8a899b
      Fujii Masao authored
      This commit changes xact_desc() so that it reports the detail information about
      PREPARE TRANSACTION record, like GID (global transaction identifier),
      timestamp at prepare transaction, delete-on-abort/commit relations,
      XID of subtransactions, and invalidation messages. These are helpful
      when diagnosing 2PC-related troubles.
      
      Author: Fujii Masao
      Reviewed-by: Michael Paquier, Andrey Lepikhov, Kyotaro Horiguchi, Julien Rouhaud, Alvaro Herrera
      Discussion: https://postgr.es/m/CAHGQGwEvhASad4JJnCv=0dW2TJypZgW_Vpb-oZik2a3utCqcrA@mail.gmail.com
      7b8a899b
    • Michael Paquier's avatar
      Add regression test for two-phase transaction in postgres_fdw · 94fec485
      Michael Paquier authored
      postgres_fdw does not support two-phase transactions, so let's add a
      small negative test case to check after it.  Note that this is checked
      using an end-of-xact callback to ensure a proper connection cleanup with
      the foreign server, which is called before checking if a server is able
      to handle 2PC with max_prepared_xacts, so this test does not need an
      alternate output file.
      
      Author: Gilles Darold
      Discussion: https://postgr.es/m/20191108090507.GC1768@paquier.xyz
      94fec485
    • Amit Kapila's avatar
      Introduce the 'force' option for the Drop Database command. · 1379fd53
      Amit Kapila authored
      This new option terminates the other sessions connected to the target
      database and then drop it.  To terminate other sessions, the current user
      must have desired permissions (same as pg_terminate_backend()).  We don't
      allow to terminate the sessions if prepared transactions, active logical
      replication slots or subscriptions are present in the target database.
      
      Author: Pavel Stehule with changes by me
      Reviewed-by: Dilip Kumar, Vignesh C, Ibrar Ahmed, Anthony Nowocien,
      Ryan Lambert and Amit Kapila
      Discussion: https://postgr.es/m/CAP_rwwmLJJbn70vLOZFpxGw3XD7nLB_7+NKz46H5EOO2k5H7OQ@mail.gmail.com
      1379fd53
  5. 12 Nov, 2019 9 commits
  6. 11 Nov, 2019 8 commits
  7. 09 Nov, 2019 4 commits