1. 16 Jun, 2022 1 commit
  2. 15 Jun, 2022 1 commit
  3. 14 Jun, 2022 2 commits
    • Tom Lane's avatar
      Avoid ecpglib core dump with out-of-order operations. · 7bc21ed8
      Tom Lane authored
      If an application executed operations like EXEC SQL PREPARE
      without having first established a database connection, it could
      get a core dump instead of the expected clean failure.  This
      occurred because we did "pthread_getspecific(actual_connection_key)"
      without ever having initialized the TSD key actual_connection_key.
      The results of that are probably platform-specific, but at least
      on Linux it often leads to a crash.
      
      To fix, add calls to ecpg_pthreads_init() in the code paths that
      might use actual_connection_key uninitialized.  It's harmless
      (and hopefully inexpensive) to do that more than once.
      
      Per bug #17514 from Okano Naoki.  The problem's ancient, so
      back-patch to all supported branches.
      
      Discussion: https://postgr.es/m/17514-edd4fad547c5692c@postgresql.org
      7bc21ed8
    • Tom Lane's avatar
      Doc: clarify the default collation behavior of domains. · be35a645
      Tom Lane authored
      The previous wording was "the underlying data type's default collation
      is used", which is wrong or at least misleading.  The domain inherits
      the base type's collation behavior, which if "default" actually can
      mean that we use some non-default collation obtained from elsewhere.
      
      Per complaint from Jian He.
      
      Discussion: https://postgr.es/m/CACJufxHMR8_4WooDPjjvEdaxB2hQ5a49qthci8fpKP0MKemVRQ@mail.gmail.com
      be35a645
  4. 13 Jun, 2022 2 commits
  5. 10 Jun, 2022 4 commits
  6. 08 Jun, 2022 3 commits
    • Tom Lane's avatar
      Doc: copy-edit "jsonb Indexing" section. · 0ccef410
      Tom Lane authored
      The patch introducing jsonpath dropped a para about that between
      two related examples, and didn't bother updating the introductory
      sentences that it falsified.  The grammar was pretty shaky as well.
      0ccef410
    • Peter Eisentraut's avatar
      Fix whitespace · 804a5079
      Peter Eisentraut authored
      804a5079
    • David Rowley's avatar
      Harden Memoization code against broken data types · cbcea3b9
      David Rowley authored
      Bug #17512 highlighted that a suitably broken data type could cause the
      backend to crash if either the hash function or equality function were in
      someway non-deterministic based on their input values.  Such a data type
      could cause a crash of the backend due to some code which assumes that
      we'll always find a hash table entry corresponding to an item in the
      Memoize LRU list.
      
      Here we remove the assumption that we'll always find the entry
      corresponding to the given LRU list item and add run-time checks to verify
      we have found the given item in the cache.
      
      This is not a fix for bug #17512, but it will turn the crash reported by
      that bug report into an internal ERROR.
      
      Reported-by: Ales Zeleny
      Reviewed-by: Tom Lane
      Discussion: https://postgr.es/m/CAApHDvpxFSTwvoYWT7kmFVSZ9zLAeHb=S9vrz=RExMgSkQNWqw@mail.gmail.com
      Backpatch-through: 14, where Memoize was added.
      cbcea3b9
  7. 07 Jun, 2022 1 commit
    • Tom Lane's avatar
      Fix off-by-one loop termination condition in pg_stat_get_subscription(). · 5c3b5f7d
      Tom Lane authored
      pg_stat_get_subscription scanned one more LogicalRepWorker array entry
      than is really allocated.  In the worst case this could lead to SIGSEGV,
      if the LogicalRepCtx data structure is near the end of shared memory.
      That seems quite unlikely though (thanks to the ordering of calls in
      CreateSharedMemoryAndSemaphores) and we've heard no field reports of it.
      A more likely misbehavior is one row of garbage data in the function's
      result, but even that is not real likely because of the check that the
      pid field matches some live backend.
      
      Report and fix by Kuntal Ghosh.  This bug is old, so back-patch
      to all supported branches.
      
      Discussion: https://postgr.es/m/CAGz5QCJykEDzW6jQK6Yz7Qh_PMtD=95de_7QoocbVR2Qy8hWZA@mail.gmail.com
      5c3b5f7d
  8. 06 Jun, 2022 3 commits
    • Tom Lane's avatar
      Don't fail on libpq-generated error reports in pg_amcheck. · 32a85ee4
      Tom Lane authored
      An error PGresult generated by libpq itself, such as a report of
      connection loss, won't have broken-down error fields.
      should_processing_continue() blithely assumed that
      PG_DIAG_SEVERITY_NONLOCALIZED would always be present, and would
      dump core if it wasn't.
      
      Per grepping to see if 6d157e7cb's mistake was repeated elsewhere.
      32a85ee4
    • Tom Lane's avatar
      Don't fail on libpq-generated error reports in ecpg_raise_backend(). · a5dbca46
      Tom Lane authored
      An error PGresult generated by libpq itself, such as a report of
      connection loss, won't have broken-down error fields.
      ecpg_raise_backend() blithely assumed that PG_DIAG_MESSAGE_PRIMARY
      would always be present, and would end up passing a NULL string
      pointer to snprintf when it isn't.  That would typically crash
      before 3779ac62d, and it would fail to provide a useful error report
      in any case.  Best practice is to substitute PQerrorMessage(conn)
      in such cases, so do that.
      
      Per bug #17421 from Masayuki Hirose.  Back-patch to all supported
      branches.
      
      Discussion: https://postgr.es/m/17421-790ff887e3188874@postgresql.org
      a5dbca46
    • Michael Paquier's avatar
      Fix psql's single transaction mode on client-side errors with -c/-f switches · a04ccf6d
      Michael Paquier authored
      psql --single-transaction is able to handle multiple -c and -f switches
      in a single transaction since d5563d7d, but this had the surprising
      behavior of forcing a transaction COMMIT even if psql failed with an
      error in the client (for example incorrect path given to \copy), which
      would generate an error, but still commit any changes that were already
      applied in the backend.  This commit makes the behavior more consistent,
      by enforcing a transaction ROLLBACK if any commands fail, both
      client-side and backend-side, so as no changes are applied if one error
      happens in any of them.
      
      Some tests are added on HEAD to provide some coverage about all that.
      Backend-side errors are unreliable as IPC::Run can complain on SIGPIPE
      if psql quits before reading a query result, but that should work
      properly in the case where any errors come from psql itself, which is
      what the original report is about.
      
      Reported-by: Christoph Berg
      Author: Kyotaro Horiguchi, Michael Paquier
      Discussion: https://postgr.es/m/17504-76b68018e130415e@postgresql.org
      Backpatch-through: 10
      a04ccf6d
  9. 03 Jun, 2022 2 commits
  10. 02 Jun, 2022 1 commit
  11. 01 Jun, 2022 4 commits
  12. 31 May, 2022 4 commits
  13. 30 May, 2022 1 commit
  14. 29 May, 2022 2 commits
  15. 28 May, 2022 1 commit
  16. 26 May, 2022 2 commits
    • Tom Lane's avatar
      Remove misguided SSL key file ownership check in libpq. · b4be4a08
      Tom Lane authored
      Commits a59c79564 et al. tried to sync libpq's SSL key file
      permissions checks with what we've used for years in the backend.
      We did not intend to create any new failure cases, but it turns out
      we did: restricting the key file's ownership breaks cases where the
      client is allowed to read a key file despite not having the identical
      UID.  In particular a client running as root used to be able to read
      someone else's key file; and having seen that I suspect that there are
      other, less-dubious use cases that this restriction breaks on some
      platforms.
      
      We don't really need an ownership check, since if we can read the key
      file despite its having restricted permissions, it must have the right
      ownership --- under normal conditions anyway, and the point of this
      patch is that any additional corner cases where that works should be
      deemed allowable, as they have been historically.  Hence, just drop
      the ownership check, and rearrange the permissions check to get rid
      of its faulty assumption that geteuid() can't be zero.  (Note that the
      comparable backend-side code doesn't have to cater for geteuid() == 0,
      since the server rejects that very early on.)
      
      This does have the end result that the permissions safety check used
      for a root user's private key file is weaker than that used for
      anyone else's.  While odd, root really ought to know what she's doing
      with file permissions, so I think this is acceptable.
      
      Per report from Yogendra Suralkar.  Like the previous patch,
      back-patch to all supported branches.
      
      Discussion: https://postgr.es/m/MW3PR15MB3931DF96896DC36D21AFD47CA3D39@MW3PR15MB3931.namprd15.prod.outlook.com
      b4be4a08
    • Robert Haas's avatar
      In CREATE FOREIGN TABLE syntax synopsis, fix partitioning stuff. · a5fc06bf
      Robert Haas authored
      Foreign tables can be partitioned, but previous documentation commits
      left the syntax synopsis both incomplete and incorrect.
      
      Justin Pryzby and Amit Langote
      
      Discussion: http://postgr.es/m/20220521130922.GX19626@telsasoft.com
      a5fc06bf
  17. 21 May, 2022 2 commits
    • Tom Lane's avatar
      Show 'AS "?column?"' explicitly when it's important. · 6f7eec11
      Tom Lane authored
      ruleutils.c was coded to suppress the AS label for a SELECT output
      expression if the column name is "?column?", which is the parser's
      fallback if it can't think of something better.  This is fine, and
      avoids ugly clutter, so long as (1) nothing further up in the parse
      tree relies on that column name or (2) the same fallback would be
      assigned when the rule or view definition is reloaded.  Unfortunately
      (2) is far from certain, both because ruleutils.c might print the
      expression in a different form from how it was originally written
      and because FigureColname's rules might change in future releases.
      So we shouldn't rely on that.
      
      Detecting exactly whether there is any outer-level use of a SELECT
      column name would be rather expensive.  This patch takes the simpler
      approach of just passing down a flag indicating whether there *could*
      be any outer use; for example, the output column names of a SubLink
      are not referenceable, and we also do not care about the names exposed
      by the right-hand side of a setop.  This is sufficient to suppress
      unwanted clutter in all but one case in the regression tests.  That
      seems like reasonable evidence that it won't be too much in users'
      faces, while still fixing the cases we need to fix.
      
      Per bug #17486 from Nicolas Lutic.  This issue is ancient, so
      back-patch to all supported branches.
      
      Discussion: https://postgr.es/m/17486-1ad6fd786728b8af@postgresql.org
      6f7eec11
    • Michael Paquier's avatar
      doc: Mention pg_read_all_stats in description of track_activities · 7f798e89
      Michael Paquier authored
      The description of track_activities mentioned that it is visible to
      superusers and that the information related to the current session can
      be seen, without telling about pg_read_all_stats.  Roles that are
      granted the privileges of pg_read_all_stats can also see this
      information, so mention it in the docs.
      
      Author: Ian Barwick
      Reviewed-by: Nathan Bossart
      Discussion: https://postgr.es/m/CAB8KJ=jhPyYFu-A5r-ZGP+Ax715mUKsMxAGcEQ9Cx_mBAmrPow@mail.gmail.com
      Backpatch-through: 10
      7f798e89
  18. 20 May, 2022 2 commits
  19. 19 May, 2022 2 commits
    • Tom Lane's avatar
      Doc: clarify location of libpq's default service file on Windows. · 3a8d83ca
      Tom Lane authored
      The documentation didn't specify the name of the per-user service file
      on Windows, and extrapolating from the pattern used for other config
      files gave the wrong answer.  The fact that it isn't consistent with the
      others sure seems like a bug, but it's far too late to change that now;
      we'd just penalize people who worked it out in the past.  So, simply
      document the true state of affairs.
      
      In passing, fix some gratuitous differences between the discussions
      of the service file and the password file.
      
      Julien Rouhaud, per question from Dominique Devienne.
      
      Backpatch to all supported branches.  I (tgl) also chose to back-patch
      the part of commit ba356a39 that touched libpq.sgml's description of
      the service file --- in hindsight, I'm not sure why I didn't do so at
      the time, as it includes some fairly essential information.
      
      Discussion: https://postgr.es/m/CAFCRh-_mdLrh8eYVzhRzu4c8bAFEBn=rwoHOmFJcQOTsCy5nig@mail.gmail.com
      3a8d83ca
    • Alvaro Herrera's avatar
      Repurpose PROC_COPYABLE_FLAGS as PROC_XMIN_FLAGS · 8d9d1286
      Alvaro Herrera authored
      This is a slight, convenient semantics change from what commit
      0f0cfb494004 ("Fix parallel operations that prevent oldest xmin from
      advancing") introduced that lets us simplify the coding in the one place
      where it is used.
      
      Backpatch to 13.  This is related to commit 6fea65508a1a ("Tighten
      ComputeXidHorizons' handling of walsenders") rewriting the code site
      where this is used, which has not yet been backpatched, but it may well
      be in the future.
      Reviewed-by: default avatarMasahiko Sawada <sawada.mshk@gmail.com>
      Discussion: https://postgr.es/m/202204191637.eldwa2exvguw@alvherre.pgsql
      8d9d1286