1. 13 Nov, 2019 9 commits
    • 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
  2. 12 Nov, 2019 9 commits
  3. 11 Nov, 2019 8 commits
  4. 09 Nov, 2019 6 commits
  5. 08 Nov, 2019 6 commits
  6. 07 Nov, 2019 2 commits
    • Bruce Momjian's avatar
      docs: clarify that only INSERT and UPDATE triggers can mod. NEW · c10fae21
      Bruce Momjian authored
      The point is that DELETE triggers cannot modify any values.
      
      Reported-by: Eugen Konkov
      
      Discussion: https://postgr.es/m/919823407.20191029175436@yandex.ru
      
      Backpatch-through: 9.4
      c10fae21
    • Tom Lane's avatar
      Move declaration of ecpg_gettext() to a saner place. · c8cb98ec
      Tom Lane authored
      Declaring this in the client-visible header ecpglib.h was a pretty
      poor decision.  It's not meant to be application-callable (and if
      it was, putting it outside the extern "C" { ... } wrapper means
      that C++ clients would fail to call it).  And the declaration would
      not even compile for a client, anyway, since it would not have the
      macro pg_attribute_format_arg().  Fortunately, it seems that no
      clients have tried to include this header with ENABLE_NLS defined,
      or we'd have gotten complaints about that.  But we have no business
      putting such a restriction on client code.
      
      Move the declaration to ecpglib_extern.h, since in fact nothing
      outside src/interfaces/ecpg/ecpglib/ needs to call it.
      
      The practical effect of this is just that clients can now safely
      #include ecpglib.h while having ENABLE_NLS defined, but that seems
      like enough of a reason to back-patch it.
      
      Discussion: https://postgr.es/m/20590.1573069709@sss.pgh.pa.us
      c8cb98ec