Skip to content
Snippets Groups Projects
  1. Nov 08, 2017
    • Tom Lane's avatar
      Fix two violations of the ResourceOwnerEnlarge/Remember protocol. · 442bc416
      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
      442bc416
  2. Nov 07, 2017
    • Tom Lane's avatar
      Fix unportable usage of <ctype.h> functions. · e836502d
      Tom Lane authored
      isdigit(), isspace(), etc are likely to give surprising results if passed a
      signed char.  We should always cast the argument to unsigned char to avoid
      that.  Error in commit 63d6b97f, found by buildfarm member gaur.
      Back-patch to 9.3, like that commit.
      e836502d
    • Tom Lane's avatar
      Fix version numbering foulups exposed by 10.1. · 958fe549
      Tom Lane authored
      configure computed PG_VERSION_NUM incorrectly.  (Coulda sworn I tested
      that logic back when, but it had an obvious thinko.)
      
      pg_upgrade had not been taught about the new dispensation with just
      one part in the major version number.
      
      Both things accidentally failed to fail with 10.0, but with 10.1 we
      got the wrong results.
      
      Per buildfarm.
  3. Nov 06, 2017
    • Tom Lane's avatar
      Stamp 10.1. · 0b35d54c
      Tom Lane authored
      0b35d54c
    • Tom Lane's avatar
      Last-minute updates for release notes. · 50abeafc
      Tom Lane authored
      Security: CVE-2017-12172, CVE-2017-15098, CVE-2017-15099
      50abeafc
    • Tom Lane's avatar
      Make json{b}_populate_recordset() use the right tuple descriptor. · c30f082d
      Tom Lane authored
      json{b}_populate_recordset() used the tuple descriptor created from the
      query-level AS clause without worrying about whether it matched the actual
      input record type.  If it didn't, that would usually result in a crash,
      though disclosure of server memory contents seems possible as well, for a
      skilled attacker capable of issuing crafted SQL commands.  Instead, use
      the query-supplied descriptor only when there is no input tuple to look at,
      and otherwise get a tuple descriptor based on the input tuple's own type
      marking.  The core code will detect any type mismatch in the latter case.
      
      Michael Paquier and Tom Lane, per a report from David Rowley.
      Back-patch to 9.3 where this functionality was introduced.
      
      Security: CVE-2017-15098
      c30f082d
    • Noah Misch's avatar
      start-scripts: switch to $PGUSER before opening $PGLOG. · 6b0b983f
      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
      6b0b983f
    • Dean Rasheed's avatar
      Always require SELECT permission for ON CONFLICT DO UPDATE. · 3f808957
      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
      3f808957
    • Noah Misch's avatar
      Add a temp-install prerequisite to "check"-like targets not having one. · 937f6780
      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.
      937f6780
  4. Nov 05, 2017
  5. Nov 04, 2017
  6. Nov 03, 2017
  7. Nov 02, 2017
  8. Nov 01, 2017
  9. Oct 31, 2017
    • Tom Lane's avatar
      Fix underqualified cast-target type names in pg_dump and psql queries. · 9cf2b854
      Tom Lane authored
      Queries running with some non-pg_catalog schema frontmost in their search
      path need to be careful to schema-qualify type names that should be sought
      in pg_catalog.  Vitaly Burovoy reported an oversight of this sort in
      pg_dump's dumpSequence, and grepping detected another one in psql's
      describeOneTableDetails, both introduced by sequence-related changes in
      v10.  In pg_dump, we can fix things by removing the cast altogether, since
      it doesn't really matter what data types are reported for these query
      result columns.  Likewise in psql, the query seemed to be working unduly
      hard to get a result that's guaranteed to be exactly 'bigint'.
      
      I also changed a couple of occurrences of "::char" similarly.  These are
      not bugs, since "char" is a typename keyword and not subject to search_path
      rules, but it seems better to use uniform style.
      
      Vitaly Burovoy and Tom Lane
      
      Discussion: https://postgr.es/m/CAKOSWN=ds66zLw2SqkLTM8wbXFgDbc_OdkmT3dJfPT2mE5kipA@mail.gmail.com
      9cf2b854
  10. Oct 30, 2017
    • Tom Lane's avatar
      Doc: call out UPDATE syntax change as a v10 compatibility issue. · 7becb5fa
      Tom Lane authored
      The change made by commit 906bfcad means that if you're writing
      a parenthesized column list in UPDATE ... SET, but that column list
      is only one column, you now need to write ROW(expression) on the
      righthand side, not just a parenthesized expression.  This was an
      intentional change for spec compatibility and potential future
      expansion of the possibilities for the RHS, but I'd neglected to
      document it as a compatibility issue, figuring that hardly anyone
      would bother with parenthesized syntax for a single target column.
      I was wrong, as shown by questions from Justin Pryzby, Adam Brusselback,
      and others.  Move the release note item into the compatibility section
      and point out the behavior change for a single target column.
      
      Discussion: https://postgr.es/m/CAMjNa7cDLzPcs0xnRpkvqmJ6Vb6G3EH8CYGp9ZBjXdpFfTz6dg@mail.gmail.com
      7becb5fa
    • Alvaro Herrera's avatar
      Fix autovacuum work item error handling · 52ca7572
      Alvaro Herrera authored
      In autovacuum's "work item" processing, a few strings were allocated in
      the current transaction's memory context, which goes away during error
      handling; if an error happened during execution of the work item, the
      pfree() calls to clean up afterwards would try to release already-released
      memory, possibly leading to a crash.  In branch master, this was already
      fixed by commit 335f3d04, so backpatch that to REL_10_STABLE to fix
      the problem there too.
      
      As a secondary problem, verify that the autovacuum worker is connected
      to the right database for each work item; otherwise some items would be
      discarded by workers in other databases.
      
      Reported-by: Justin Pryzby
      Discussion: https://postgr.es/m/20171014035732.GB31726@telsasoft.com
      52ca7572
    • Magnus Hagander's avatar
      Fix typo · 0f1fbe71
      Magnus Hagander authored
      0f1fbe71
  11. Oct 29, 2017
  12. Oct 28, 2017
  13. Oct 27, 2017
    • Tom Lane's avatar
      Fix crash when columns have been added to the end of a view. · ddde3b4f
      Tom Lane authored
      expandRTE() supposed that an RTE_SUBQUERY subquery must have exactly
      as many non-junk tlist items as the RTE has column aliases for it.
      This was true at the time the code was written, and is still true so
      far as parse analysis is concerned --- but when the function is used
      during planning, the subquery might have appeared through insertion
      of a view that now has more columns than it did when the outer query
      was parsed.  This results in a core dump if, for instance, we have
      to expand a whole-row Var that references the subquery.
      
      To avoid crashing, we can either stop expanding the RTE when we run
      out of aliases, or invent new aliases for the added columns.  While
      the latter might be more useful, the former is consistent with what
      expandRTE() does for composite-returning functions in the RTE_FUNCTION
      case, so it seems like we'd better do it that way.
      
      Per bug #14876 from Samuel Horwitz.  This has been busted since commit
      ff1ea217 allowed views to acquire more columns, so back-patch to all
      supported branches.
      
      Discussion: https://postgr.es/m/20171026184035.1471.82810@wrigleys.postgresql.org
      ddde3b4f
    • Tom Lane's avatar
      Rethink the dependencies recorded for FieldSelect/FieldStore nodes. · 8be10224
      Tom Lane authored
      On closer investigation, commits f3ea3e3e et al were a few bricks
      shy of a load.  What we need is not so much to lock down the result
      type of a FieldSelect, as to lock down the existence of the column
      it's trying to extract.  Otherwise, we can break it by dropping that
      column.  The dependency on the result type is then held indirectly
      through the column, and doesn't need to be recorded explicitly.
      
      Out of paranoia, I left in the code to record a dependency on the
      result type, but it's used only if we can't identify the pg_class OID
      for the column.  That shouldn't ever happen right now, AFAICS, but
      it seems possible that in future the input node could be marked as
      being of type RECORD rather than some specific composite type.
      
      Likewise for FieldStore.
      
      Like the previous patch, back-patch to all supported branches.
      
      Discussion: https://postgr.es/m/22571.1509064146@sss.pgh.pa.us
      8be10224
    • Robert Haas's avatar
      Move new structure member to the end. · 69fc2ca4
      Robert Haas authored
      Reduces ABI breakage.  Per Tom Lane.
      
      Discussion: http://postgr.es/m/4035.1509113974@sss.pgh.pa.us
      69fc2ca4
    • Tom Lane's avatar
      Doc: mention that you can't PREPARE TRANSACTION after NOTIFY. · 7b233fce
      Tom Lane authored
      The NOTIFY page said this already, but the PREPARE TRANSACTION page
      missed it.
      
      Discussion: https://postgr.es/m/20171024010602.1488.80066@wrigleys.postgresql.org
      7b233fce
    • Robert Haas's avatar
      Fix mistaken failure to allow parallelism in corner case. · 965a16fa
      Robert Haas authored
      If we try to run a parallel plan in serial mode because, for example,
      it's going to be scanned via a cursor, but for some reason we're
      already in parallel mode (for example because an outer query is
      running in parallel), we'd incorrectly try to launch workers.
      Fix by adding a flag to the EState, so that we can be certain that
      ExecutePlan() and ExecGather()/ExecGatherMerge() will have the same
      idea about whether we are executing serially or in parallel.
      
      Report and fix by Amit Kapila with help from Kuntal Ghosh.  A few
      tweaks by me.
      
      Discussion: http://postgr.es/m/CAA4eK1+_BuZrmVCeua5Eqnm4Co9DAXdM5HPAOE2J19ePbR912Q@mail.gmail.com
      965a16fa
  14. Oct 26, 2017
    • Tom Lane's avatar
      Make setrefs.c match by ressortgroupref even for plain Vars. · 6a81ba1d
      Tom Lane authored
      Previously, we skipped using search_indexed_tlist_for_sortgroupref()
      if the tlist expression being sought in the child plan node was merely
      a Var.  This is purely an optimization, based on the theory that
      search_indexed_tlist_for_var() is faster, and one copy of a Var should
      be as good as another.  However, the GROUPING SETS patch broke the
      latter assumption: grouping columns containing the "same" Var can
      sometimes have different outputs, as shown in the test case added here.
      So do it the hard way whenever a ressortgroupref marking exists.
      
      (If this seems like a bottleneck, we could imagine building a tlist index
      data structure for ressortgroupref values, as we do for Vars.  But I'll
      let that idea go until there's some evidence it's worthwhile.)
      
      Back-patch to 9.6.  The problem also exists in 9.5 where GROUPING SETS
      came in, but this patch is insufficient to resolve the problem in 9.5:
      there is some obscure dependency on the upper-planner-pathification
      work that happened in 9.6.  Given that this is such a weird corner case,
      and no end users have complained about it, it doesn't seem worth the work
      to develop a fix for 9.5.
      
      Patch by me, per a report from Heikki Linnakangas.  (This does not fix
      Heikki's original complaint, just the follow-on one.)
      
      Discussion: https://postgr.es/m/aefc657e-edb2-64d5-6df1-a0828f6e9104@iki.fi
      6a81ba1d
Loading