Skip to content
Snippets Groups Projects
  1. Jun 04, 2013
    • Tom Lane's avatar
      Provide better message when CREATE EXTENSION can't find a target schema. · 2ff74efa
      Tom Lane authored
      The new message (and SQLSTATE) matches the corresponding error cases in
      namespace.c.
      
      This was thought to be a "can't happen" case when extension.c was written,
      so we didn't think hard about how to report it.  But it definitely can
      happen in 9.2 and later, since we no longer require search_path to contain
      any valid schema names.  It's probably also possible in 9.1 if search_path
      came from a noninteractive source.  So, back-patch to all releases
      containing this code.
      
      Per report from Sean Chittenden, though this isn't exactly his patch.
      2ff74efa
    • Tom Lane's avatar
      Add ARM64 (aarch64) support to s_lock.h. · 612ecf31
      Tom Lane authored
      Use the same gcc atomic functions as we do on newer ARM chips.
      (Basically this is a copy and paste of the __arm__ code block,
      but omitting the SWPB option since that definitely won't work.)
      
      Back-patch to 9.2.  The patch would work further back, but we'd also
      need to update config.guess/config.sub in older branches to make them
      build out-of-the-box, and there hasn't been demand for it.
      
      Mark Salter
      612ecf31
    • Tom Lane's avatar
      Fix memory leak in LogStandbySnapshot(). · 81fe138b
      Tom Lane authored
      The array allocated by GetRunningTransactionLocks() needs to be pfree'd
      when we're done with it.  Otherwise we leak some memory during each
      checkpoint, if wal_level = hot_standby.  This manifests as memory bloat
      in the checkpointer process, or in bgwriter in versions before we made
      the checkpointer separate.
      
      Reported and fixed by Naoya Anzai.  Back-patch to 9.0 where the issue
      was introduced.
      
      In passing, improve comments for GetRunningTransactionLocks(), and add
      an Assert that we didn't overrun the palloc'd array.
      81fe138b
  2. Jun 03, 2013
    • Tom Lane's avatar
      Add semicolons to eval'd strings to hide a minor Perl behavioral change. · cc510d97
      Tom Lane authored
      "eval q{foo}" used to complain that the error was on line 2 of the eval'd
      string, because eval internally tacked on "\n;" so that the end of the
      erroneous command was indeed on line 2.  But as of Perl 5.18 it more
      sanely says that the error is on line 1.  To avoid Perl-version-dependent
      regression test results, use "eval q{foo;}" instead in the two places
      where this matters.  Per buildfarm.
      
      Since people might try to use newer Perl versions with older PG releases,
      back-patch as far as 9.0 where these test cases were added.
      cc510d97
    • Tom Lane's avatar
      Allow type_func_name_keywords in some places where they weren't before. · 17a22a74
      Tom Lane authored
      This change makes type_func_name_keywords less reserved than they were
      before, by allowing them for role names, language names, EXPLAIN and COPY
      options, and SET values for GUCs; which are all places where few if any
      actual keywords could appear instead, so no new ambiguities are introduced.
      
      The main driver for this change is to allow "COPY ... (FORMAT BINARY)"
      to work without quoting the word "binary".  That is an inconsistency that
      has been complained of repeatedly over the years (at least by Pavel Golub,
      Kurt Lidl, and Simon Riggs); but we hadn't thought of any non-ugly solution
      until now.
      
      Back-patch to 9.0 where the COPY (FORMAT BINARY) syntax was introduced.
      17a22a74
  3. May 29, 2013
  4. May 27, 2013
    • Stephen Frost's avatar
      Documentation fix for ALTER TYPE .. RENAME · 02230d3c
      Stephen Frost authored
      The documentation for ALTER TYPE .. RENAME claimed to support a
      RESTRICT/CASCADE option at the 'type' level, which wasn't implemented
      and doesn't make a whole lot of sense to begin with.  What is supported,
      and previously undocumented, is
      
      ALTER TYPE .. RENAME ATTRIBUTE .. RESTRICT/CASCADE.
      
      I've updated the documentation and back-patched this to 9.1 where it was
      first introduced.
      02230d3c
  5. May 23, 2013
    • Robert Haas's avatar
      Fix typo in comment. · 6e83fc6d
      Robert Haas authored
      Pavan Deolasee
      6e83fc6d
    • Heikki Linnakangas's avatar
      Print line number correctly in COPY. · fcf91c06
      Heikki Linnakangas authored
      When COPY uses the multi-insert method to insert a batch of tuples into the
      heap at a time, incorrect line number was printed if something went wrong in
      inserting the index tuples (primary key failure, for exampl), or processing
      after row triggers.
      
      Fixes bug #8173 reported by Lloyd Albin. Backpatch to 9.2, where the multi-
      insert code was added.
      fcf91c06
  6. May 16, 2013
    • Tom Lane's avatar
      Fix fd.c to preserve errno where needed. · e7e005ed
      Tom Lane authored
      PathNameOpenFile failed to ensure that the correct value of errno was
      returned to its caller after a failure (because it incorrectly supposed
      that free() can never change errno).  In some cases this would result
      in a user-visible failure because an expected ENOENT errno was replaced
      with something else.  Bogus EINVAL failures have been observed on OS X,
      for example.
      
      There were also a couple of places that could mangle an important value
      of errno if FDDEBUG was defined.  While the usefulness of that debug
      support is highly debatable, we might as well make it safe to use,
      so add errno save/restore logic to the DO_DB macro.
      
      Per bug #8167 from Nelson Minar, diagnosed by RhodiumToad.
      Back-patch to all supported branches.
      e7e005ed
  7. May 13, 2013
    • Tom Lane's avatar
      Fix handling of OID wraparound while in standalone mode. · 630a8af5
      Tom Lane authored
      If OID wraparound should occur while in standalone mode (unlikely but
      possible), we want to advance the counter to FirstNormalObjectId not
      FirstBootstrapObjectId.  Otherwise, user objects might be created with OIDs
      in the system-reserved range.  That isn't immediately harmful but it poses
      a risk of conflicts during future pg_upgrade operations.
      
      Noted by Andres Freund.  Back-patch to all supported branches, since all of
      them are supported sources for pg_upgrade operations.
      630a8af5
  8. May 11, 2013
  9. May 10, 2013
    • Tom Lane's avatar
      Guard against input_rows == 0 in estimate_num_groups(). · 4ebbbf3c
      Tom Lane authored
      This case doesn't normally happen, because the planner usually clamps
      all row estimates to at least one row; but I found that it can arise
      when dealing with relations excluded by constraints.  Without a defense,
      estimate_num_groups() can return zero, which leads to divisions by zero
      inside the planner as well as assertion failures in the executor.
      
      An alternative fix would be to change set_dummy_rel_pathlist() to make
      the size estimate for a dummy relation 1 row instead of 0, but that seemed
      pretty ugly; and probably someday we'll want to drop the convention that
      the minimum rowcount estimate is 1 row.
      
      Back-patch to 8.4, as the problem can be demonstrated that far back.
      4ebbbf3c
    • Tom Lane's avatar
      Fix pgp_pub_decrypt() so it works for secret keys with passwords. · a184461a
      Tom Lane authored
      Per report from Keith Fiske.
      
      Marko Kreen
      a184461a
    • Tom Lane's avatar
      Fix management of fn_extra caching during repeated GiST index scans. · eb6cc854
      Tom Lane authored
      Commit d22a09dc introduced official support
      for GiST consistentFns that want to cache data using the FmgrInfo fn_extra
      pointer: the idea was to preserve the cached values across gistrescan(),
      whereas formerly they'd been leaked.  However, there was an oversight in
      that, namely that multiple scan keys might reference the same column's
      consistentFn; the code would result in propagating the same cache value
      into multiple scan keys, resulting in crashes or wrong answers.  Use a
      separate array instead to ensure that each scan key keeps its own state.
      
      Per bug #8143 from Joel Roller.  Back-patch to 9.2 where the bug was
      introduced.
      eb6cc854
  10. May 09, 2013
    • Tom Lane's avatar
      Use pg_dump's --quote-all-identifiers option in pg_upgrade. · 44f5bb24
      Tom Lane authored
      This helps guard against changes in the set of reserved keywords from
      one version to another.  In theory it should only be an issue if we
      de-reserve a keyword in a newer release, since that can create the type
      of problem shown in bug #8128.
      
      Back-patch to 9.1 where the --quote-all-identifiers option was added.
      44f5bb24
  11. May 08, 2013
  12. May 04, 2013
  13. May 02, 2013
    • Heikki Linnakangas's avatar
      Fix thinko in comment. · 7fa56e63
      Heikki Linnakangas authored
      WAL segment means a 16 MB physical WAL file; this comment meant a logical
      4 GB log file.
      
      Amit Langote. Apply to backbranches only, as the comment is gone in master.
      7fa56e63
    • Tom Lane's avatar
      Fix permission tests for views/tables proven empty by constraint exclusion. · 15b04210
      Tom Lane authored
      A view defined as "select <something> where false" had the curious property
      that the system wouldn't check whether users had the privileges necessary
      to select from it.  More generally, permissions checks could be skipped
      for tables referenced in sub-selects or views that were proven empty by
      constraint exclusion (although some quick testing suggests this seldom
      happens in cases of practical interest).  This happened because the planner
      failed to include rangetable entries for such tables in the finished plan.
      
      This was noticed in connection with erroneous handling of materialized
      views, but actually the issue is quite unrelated to matviews.  Therefore,
      revert commit 200ba166 in favor of a more
      direct test for the real problem.
      
      Back-patch to 9.2 where the bug was introduced (by commit
      7741dd65).
      15b04210
  14. Apr 30, 2013
    • Heikki Linnakangas's avatar
      Install recycled WAL segments with current timeline ID during recovery. · 4aed94f1
      Heikki Linnakangas authored
      This is a follow-up to the earlier fix, which changed the recycling logic
      to recycle WAL segments under the current recovery target timeline. That
      turns out to be a bad idea, because installing a recycled segment with
      a TLI higher than what we're recovering at the moment means that the recovery
      logic will find the recycled WAL segment and try to replay it. It will fail,
      but but the mere presence of such a WAL segment will mask any other, real,
      file with the same log/seg, but smaller TLI.
      
      Per report from Mitsumasa Kondo. Apply to 9.1 and 9.2, like the previous
      fix. Master was already doing this differently; this patch makes 9.1 and
      9.2 to do the same thing as master.
      4aed94f1
  15. Apr 29, 2013
    • Tom Lane's avatar
      Postpone creation of pathkeys lists to fix bug #8049. · 841c9b6b
      Tom Lane authored
      This patch gets rid of the concept of, and infrastructure for,
      non-canonical PathKeys; we now only ever create canonical pathkey lists.
      
      The need for non-canonical pathkeys came from the desire to have
      grouping_planner initialize query_pathkeys and related pathkey lists before
      calling query_planner.  However, since query_planner didn't actually *do*
      anything with those lists before they'd been made canonical, we can get rid
      of the whole mess by just not creating the lists at all until the point
      where we formerly canonicalized them.
      
      There are several ways in which we could implement that without making
      query_planner itself deal with grouping/sorting features (which are
      supposed to be the province of grouping_planner).  I chose to add a
      callback function to query_planner's API; other alternatives would have
      required adding more fields to PlannerInfo, which while not bad in itself
      would create an ABI break for planner-related plugins in the 9.2 release
      series.  This still breaks ABI for anything that calls query_planner
      directly, but it seems somewhat unlikely that there are any such plugins.
      
      I had originally conceived of this change as merely a step on the way to
      fixing bug #8049 from Teun Hoogendoorn; but it turns out that this fixes
      that bug all by itself, as per the added regression test.  The reason is
      that now get_eclass_for_sort_expr is adding the ORDER BY expression at the
      end of EquivalenceClass creation not the start, and so anything that is in
      a multi-member EquivalenceClass has already been created with correct
      em_nullable_relids.  I am suspicious that there are related scenarios in
      which we still need to teach get_eclass_for_sort_expr to compute correct
      nullable_relids, but am not eager to risk destabilizing either 9.2 or 9.3
      to fix bugs that are only hypothetical.  So for the moment, do this and
      stop here.
      
      Back-patch to 9.2 but not to earlier branches, since they don't exhibit
      this bug for lack of join-clause-movement logic that depends on
      em_nullable_relids being correct.  (We might have to revisit that choice
      if any related bugs turn up.)  In 9.2, don't change the signature of
      make_pathkeys_for_sortclauses nor remove canonicalize_pathkeys, so as
      not to risk more plugin breakage than we have to.
      841c9b6b
    • Kevin Grittner's avatar
      Ensure ANALYZE phase is not skipped because of canceled truncate. · 95909f3b
      Kevin Grittner authored
      Patch b19e4250 attempted to
      preserve existing behavior regarding statistics generation in the
      case that a truncation attempt was canceled due to lock conflicts.
      It failed to do this accurately in two regards: (1) autovacuum had
      previously generated statistics if the truncate attempt failed to
      initially get the lock rather than having started the attempt, and
      (2) the VACUUM ANALYZE command had always generated statistics.
      
      Both of these changes were unintended, and are reverted by this
      patch.  On review, there seems to be consensus that the previous
      failure to generate statistics when the truncate was terminated
      was more an unfortunate consequence of how that effort was
      previously terminated than a feature we want to keep; so this
      patch generates statistics even when an autovacuum truncation
      attempt terminates early.  Another unintended change which is kept
      on the basis that it is an improvement is that when a VACUUM
      command is truncating, it will the new heuristic for avoiding
      blocking other processes, rather than keeping an
      AccessExclusiveLock on the table for however long the truncation
      takes.
      
      Per multiple reports, with some renaming per patch by Jeff Janes.
      
      Backpatch to 9.0, where problem was created.
      95909f3b
  16. Apr 26, 2013
    • Joe Conway's avatar
      Ensure that user created rows in extension tables get dumped if the table is... · 4dbe52d3
      Joe Conway authored
      Ensure that user created rows in extension tables get dumped if the table is explicitly requested, either with a -t/--table switch of the table itself, or by -n/--schema switch of the schema containing the extension table. Patch reviewed by Vibhor Kumar and Dimitri Fontaine.
      
      Backpatched to 9.1 when the extension management facility was added.
      4dbe52d3
  17. Apr 25, 2013
  18. Apr 22, 2013
  19. Apr 20, 2013
    • Tom Lane's avatar
      Fix longstanding race condition in plancache.c. · c37ec840
      Tom Lane authored
      When creating or manipulating a cached plan for a transaction control
      command (particularly ROLLBACK), we must not perform any catalog accesses,
      since we might be in an aborted transaction.  However, plancache.c busily
      saved or examined the search_path for every cached plan.  If we were
      unlucky enough to do this at a moment where the path's expansion into
      schema OIDs wasn't already cached, we'd do some catalog accesses; and with
      some more bad luck such as an ill-timed signal arrival, that could lead to
      crashes or Assert failures, as exhibited in bug #8095 from Nachiket Vaidya.
      Fortunately, there's no real need to consider the search path for such
      commands, so we can just skip the relevant steps when the subject statement
      is a TransactionStmt.  This is somewhat related to bug #5269, though the
      failure happens during initial cached-plan creation rather than
      revalidation.
      
      This bug has been there since the plan cache was invented, so back-patch
      to all supported branches.
      c37ec840
  20. Apr 10, 2013
  21. Apr 07, 2013
  22. Apr 05, 2013
  23. Apr 04, 2013
  24. Apr 03, 2013
    • Tom Lane's avatar
      Avoid updating our PgBackendStatus entry when track_activities is off. · a0c2492b
      Tom Lane authored
      The point of turning off track_activities is to avoid this reporting
      overhead, but a thinko in commit 4f42b546
      caused pgstat_report_activity() to perform half of its updates anyway.
      Fix that, and also make sure that we clear all the now-disabled fields
      when transitioning to the non-reporting state.
      a0c2492b
    • Tom Lane's avatar
      Minor robustness improvements for isolationtester. · e084b144
      Tom Lane authored
      Notice and complain about PQcancel() failures.  Also, don't dump core if
      an error PGresult doesn't contain severity and message subfields, as it
      might not if it was generated by libpq itself.  (We have a longstanding
      TODO item to improve that, but in the meantime isolationtester had better
      cope.)
      
      I tripped across the latter item while investigating a trouble report on
      buildfarm member spoonbill.  As for the former, there's no evidence that
      PQcancel failure is actually involved in spoonbill's problem, but it still
      seems like a bad idea to ignore an error return code.
      e084b144
  25. Apr 01, 2013
    • Tom Lane's avatar
      Stamp 9.2.4. · 73c12276
      Tom Lane authored
    • Tom Lane's avatar
      Update release notes for 9.2.4, 9.1.9, 9.0.13, 8.4.17. · 0dfbad83
      Tom Lane authored
      Security: CVE-2013-1899, CVE-2013-1901
      0dfbad83
    • Tom Lane's avatar
      Fix insecure parsing of server command-line switches. · a6e0cd7b
      Tom Lane authored
      An oversight in commit e710b65c allowed
      database names beginning with "-" to be treated as though they were secure
      command-line switches; and this switch processing occurs before client
      authentication, so that even an unprivileged remote attacker could exploit
      the bug, needing only connectivity to the postmaster's port.  Assorted
      exploits for this are possible, some requiring a valid database login,
      some not.  The worst known problem is that the "-r" switch can be invoked
      to redirect the process's stderr output, so that subsequent error messages
      will be appended to any file the server can write.  This can for example be
      used to corrupt the server's configuration files, so that it will fail when
      next restarted.  Complete destruction of database tables is also possible.
      
      Fix by keeping the database name extracted from a startup packet fully
      separate from command-line switches, as had already been done with the
      user name field.
      
      The Postgres project thanks Mitsumasa Kondo for discovering this bug,
      Kyotaro Horiguchi for drafting the fix, and Noah Misch for recognizing
      the full extent of the danger.
      
      Security: CVE-2013-1899
      a6e0cd7b
Loading