1. 08 Nov, 2017 5 commits
    • Tom Lane's avatar
      Doc: fix erroneous example. · bd65e0c6
      Tom Lane authored
      The grammar requires these options to appear the other way 'round.
      
      jotpe@posteo.de
      
      Discussion: https://postgr.es/m/78933bd0-45ce-690e-b832-a328dd1a5567@posteo.de
      bd65e0c6
    • Tom Lane's avatar
      Fix two violations of the ResourceOwnerEnlarge/Remember protocol. · c5269472
      Tom Lane authored
      The point of having separate ResourceOwnerEnlargeFoo and
      ResourceOwnerRememberFoo functions is so that resource allocation
      can happen in between.  Doing it in some other order is just wrong.
      
      OpenTemporaryFile() did open(), enlarge, remember, which would leak the
      open file if the enlarge step ran out of memory.  Because fd.c has its own
      layer of resource-remembering, the consequences look like they'd be limited
      to an intratransaction FD leak, but it's still not good.
      
      IncrBufferRefCount() did enlarge, remember, incr-refcount, which would blow
      up if the incr-refcount step ever failed.  It was safe enough when written,
      but since the introduction of PrivateRefCountHash, I think the assumption
      that no error could happen there is pretty shaky.
      
      The odds of real problems from either bug are probably small, but still,
      back-patch to supported branches.
      
      Thomas Munro and Tom Lane, per a comment from Andres Freund
      c5269472
    • Peter Eisentraut's avatar
      Change TRUE/FALSE to true/false · 2eb4a831
      Peter Eisentraut authored
      The lower case spellings are C and C++ standard and are used in most
      parts of the PostgreSQL sources.  The upper case spellings are only used
      in some files/modules.  So standardize on the standard spellings.
      
      The APIs for ICU, Perl, and Windows define their own TRUE and FALSE, so
      those are left as is when using those APIs.
      
      In code comments, we use the lower-case spelling for the C concepts and
      keep the upper-case spelling for the SQL concepts.
      Reviewed-by: default avatarMichael Paquier <michael.paquier@gmail.com>
      2eb4a831
    • Peter Eisentraut's avatar
      Put markup in the right place · 4497f2f3
      Peter Eisentraut authored
      4497f2f3
    • Peter Eisentraut's avatar
      Expand empty end tag · 6e1e4c0d
      Peter Eisentraut authored
      6e1e4c0d
  2. 07 Nov, 2017 6 commits
  3. 06 Nov, 2017 5 commits
    • Tom Lane's avatar
      Last-minute updates for release notes. · 92d830f4
      Tom Lane authored
      Security: CVE-2017-12172, CVE-2017-15098, CVE-2017-15099
      92d830f4
    • Tom Lane's avatar
      Add tests for json{b}_populate_recordset() crash case. · b5742287
      Tom Lane authored
      The problem reported as CVE-2017-15098 was already resolved in HEAD by
      commit 37a795a6, but let's add the relevant test cases anyway.
      
      Michael Paquier and Tom Lane, per a report from David Rowley.
      
      Security: CVE-2017-15098
      b5742287
    • Noah Misch's avatar
      start-scripts: switch to $PGUSER before opening $PGLOG. · dfc015dc
      Noah Misch authored
      By default, $PGUSER has permission to unlink $PGLOG.  If $PGUSER
      replaces $PGLOG with a symbolic link, the server will corrupt the
      link-targeted file by appending log messages.  Since these scripts open
      $PGLOG as root, the attack works regardless of target file ownership.
      
      "make install" does not install these scripts anywhere.  Users having
      manually installed them in the past should repeat that process to
      acquire this fix.  Most script users have $PGLOG writable to root only,
      located in $PGDATA.  Just before updating one of these scripts, such
      users should rename $PGLOG to $PGLOG.old.  The script will then recreate
      $PGLOG with proper ownership.
      
      Reviewed by Peter Eisentraut.  Reported by Antoine Scemama.
      
      Security: CVE-2017-12172
      dfc015dc
    • Dean Rasheed's avatar
      Always require SELECT permission for ON CONFLICT DO UPDATE. · 87b2ebd3
      Dean Rasheed authored
      The update path of an INSERT ... ON CONFLICT DO UPDATE requires SELECT
      permission on the columns of the arbiter index, but it failed to check
      for that in the case of an arbiter specified by constraint name.
      
      In addition, for a table with row level security enabled, it failed to
      check updated rows against the table's SELECT policies when the update
      path was taken (regardless of how the arbiter index was specified).
      
      Backpatch to 9.5 where ON CONFLICT DO UPDATE and RLS were introduced.
      
      Security: CVE-2017-15099
      87b2ebd3
    • Noah Misch's avatar
      Add a temp-install prerequisite to "check"-like targets not having one. · c66b438d
      Noah Misch authored
      Makefile.global assigns this prerequisite to every target named "check",
      but similar targets must mention it explicitly.  Affected targets
      failed, tested $PATH binaries, or tested a stale temporary installation.
      The src/test/modules examples worked properly when called as "make -C
      src/test/modules/$FOO check", but "make -j" allowed the test to start
      before the temporary installation was in place.  Back-patch to 9.5,
      where commit dcae5fac introduced the
      shared temp-install.
      c66b438d
  4. 05 Nov, 2017 3 commits
  5. 04 Nov, 2017 5 commits
  6. 03 Nov, 2017 7 commits
  7. 02 Nov, 2017 9 commits
    • Tom Lane's avatar
      pgbench: replace run-time string comparisons with an enum identifier. · f987f83d
      Tom Lane authored
      Minor refactoring that should yield some performance benefit.
      
      Fabien Coelho, reviewed by Aleksandr Parfenov
      
      Discussion: https://postgr.es/m/alpine.DEB.2.20.1709230538130.4999@lancre
      f987f83d
    • Tom Lane's avatar
      Set the metapage's pd_lower correctly in brin, gin, and spgist indexes. · 81e334ce
      Tom Lane authored
      Previously, these index types left the pd_lower field set to the default
      SizeOfPageHeaderData, which is really a lie because it ought to point past
      whatever space is being used for metadata.  The coding accidentally failed
      to fail because we never told xlog.c that the metapage is of standard
      format --- but that's not very good, because it impedes WAL consistency
      checking, and in some cases prevents compression of full-page images.
      
      To fix, ensure that we set pd_lower correctly, not only when creating a
      metapage but whenever we write it out (these apparently redundant steps are
      needed to cope with pg_upgrade'd indexes that don't yet contain the right
      value).  This allows telling xlog.c that the page is of standard format.
      
      The WAL consistency check mask functions are made to mask only if pd_lower
      appears valid, which I think is likely unnecessary complication, since
      any metapage appearing in a v11 WAL stream should contain valid pd_lower.
      But it doesn't cost much to be paranoid.
      
      Amit Langote, reviewed by Michael Paquier and Amit Kapila
      
      Discussion: https://postgr.es/m/0d273805-0e9e-ec1a-cb84-d4da400b8f85@lab.ntt.co.jp
      81e334ce
    • Michael Meskes's avatar
      Fix float parsing in ecpg INFORMIX mode. · 6976a4f0
      Michael Meskes authored
      6976a4f0
    • Peter Eisentraut's avatar
      pg_ctl: Improve message · 4b0fbfdf
      Peter Eisentraut authored
      Change message for restarting a server from a directory without a PID
      file.  This accounts for the case where a restart happens after an
      initdb.  The new message indicates that the start has not completed yet
      and might fail.
      
      Author: Jesper Pedersen <jesper.pedersen@redhat.com>
      4b0fbfdf
    • Peter Eisentraut's avatar
      Simplify new test suite handling of passwordcheck · 637a934a
      Peter Eisentraut authored
      This changes the use of a custom configuration file to enforce the value
      of preload_shared_libraries to simply load the library during the tests.
      This removes the restriction of running installcheck on the tests, and
      simplifies its makefile contrary to what has been introduced in af7211e9.
      
      Author: Michael Paquier <michael.paquier@gmail.com>
      637a934a
    • Tom Lane's avatar
      Fix corner-case errors in brin_doupdate(). · 62a16572
      Tom Lane authored
      In some cases the BRIN code releases lock on an index page, and later
      re-acquires lock and tries to check that the tuple it was working on is
      still there.  That check was a couple bricks shy of a load.  It didn't
      consider that the page might have turned into a "revmap" page.  (The
      samepage code path doesn't call brin_getinsertbuffer(), so it isn't
      protected by the checks for revmap status there.)  It also didn't check
      whether the tuple offset was now off the end of the linepointer array.
      Since commit 24992c6d the latter case is pretty common, but at least
      in principle it could have occurred before that.  The net result is
      that concurrent updates of a BRIN index could fail with errors like
      "invalid index offnum" or "inconsistent range map".
      
      Per report from Tomas Vondra.  Back-patch to 9.5, since this code is
      substantially the same in all versions containing BRIN.
      
      Discussion: https://postgr.es/m/10d2b9f9-f427-03b8-8ad9-6af4ecacbee9@2ndquadrant.com
      62a16572
    • Peter Eisentraut's avatar
      Remove wal_keep_segments from default configuration in PostgresNode.pm · 5eb8bf2d
      Peter Eisentraut authored
      This is only used in the pg_rewind tests, so only set it there.  It's
      better if other tests run closer to a default configuration.
      
      Author: Michael Paquier <michael.paquier@gmail.com>
      5eb8bf2d
    • Peter Eisentraut's avatar
      doc: Clarify pgstattuple privileges information · 0f539341
      Peter Eisentraut authored
      The description has gotten a bit confusing over time, so rewrite the
      paragraph a bit.
      Reported-by: default avatarFeike Steenbergen <feikesteenbergen@gmail.com>
      0f539341
    • Tom Lane's avatar
      Teach planner to account for HAVING quals in aggregation plan nodes. · 7b6c0754
      Tom Lane authored
      For some reason, we have never accounted for either the evaluation cost
      or the selectivity of filter conditions attached to Agg and Group nodes
      (which, in practice, are always conditions from a HAVING clause).
      
      Applying our regular selectivity logic to post-grouping conditions is a
      bit bogus, but it's surely better than taking the selectivity as 1.0.
      Perhaps someday the extended-statistics mechanism can be taught to provide
      statistics that would help us in getting non-default estimates here.
      
      Per a gripe from Benjamin Coutu.  This is surely a bug fix, but I'm
      hesitant to back-patch because of the prospect of destabilizing existing
      plan choices.  Given that it took us this long to notice the bug, it's
      probably not hurting too many people in the field.
      
      Discussion: https://postgr.es/m/20968.1509486337@sss.pgh.pa.us
      7b6c0754