Skip to content
Snippets Groups Projects
  1. 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
  2. Apr 25, 2013
  3. Apr 22, 2013
  4. 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
  5. Apr 10, 2013
  6. Apr 07, 2013
  7. Apr 05, 2013
  8. Apr 04, 2013
  9. 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
  10. 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
    • Tom Lane's avatar
      Make REPLICATION privilege checks test current user not authenticated user. · e5fdb8fe
      Tom Lane authored
      The pg_start_backup() and pg_stop_backup() functions checked the privileges
      of the initially-authenticated user rather than the current user, which is
      wrong.  For example, a user-defined index function could successfully call
      these functions when executed by ANALYZE within autovacuum.  This could
      allow an attacker with valid but low-privilege database access to interfere
      with creation of routine backups.  Reported and fixed by Noah Misch.
      
      Security: CVE-2013-1901
      e5fdb8fe
    • Peter Eisentraut's avatar
      Translation updates · fe6b2427
      Peter Eisentraut authored
      fe6b2427
    • Tom Lane's avatar
      Ignore extra subquery outputs in set_subquery_size_estimates(). · 0044f456
      Tom Lane authored
      In commit 0f61d4dd, I added code to copy up
      column width estimates for each column of a subquery.  That code supposed
      that the subquery couldn't have any output columns that didn't correspond
      to known columns of the current query level --- which is true when a query
      is parsed from scratch, but the assumption fails when planning a view that
      depends on another view that's been redefined (adding output columns) since
      the upper view was made.  This results in an assertion failure or even a
      crash, as per bug #8025 from lindebg.  Remove the Assert and instead skip
      the column if its resno is out of the expected range.
      0044f456
  11. Mar 31, 2013
  12. Mar 30, 2013
    • Andrew Dunstan's avatar
      Avoid moving data directory in upgrade testing. · 4e205ec4
      Andrew Dunstan authored
      Windows sometimes gets upset if we rename a large directory and then try
      to use the old name quickly, as seen in occasional buildfarm failures.
      So we avoid that by building the old version in the intended
      destination in the first place instead of renaming it, similar to the
      change made for the same reason in commit b7f8465c.
      4e205ec4
  13. Mar 29, 2013
    • Tom Lane's avatar
      Document encode(bytea, 'escape')'s behavior correctly. · d2b8d060
      Tom Lane authored
      I changed this in commit fd15dba5, but
      missed the fact that the SGML documentation of the function specified
      exactly what it did.  Well, one of the two places where it's specified
      documented that --- probably I looked at the other place and thought
      nothing needed to be done.  Sync the two places where encode() and
      decode() are described.
      d2b8d060
    • Tom Lane's avatar
      Must check indisready not just indisvalid when dumping from 9.2 server. · 723acc99
      Tom Lane authored
      9.2 uses a kluge representation of "indislive"; we have to account for
      that when examining pg_index.  Simplest solution is to check indisready
      for 9.0 and 9.1 as well; that's harmless though unnecessary, so it's
      not worth making a version distinction for.
      
      Fixes oversight in commit 683abc73,
      as noted by Andres Freund.
      723acc99
  14. Mar 28, 2013
  15. Mar 27, 2013
    • Tom Lane's avatar
      Reset OpenSSL randomness state in each postmaster child process. · 21ce40c8
      Tom Lane authored
      Previously, if the postmaster initialized OpenSSL's PRNG (which it will do
      when ssl=on in postgresql.conf), the same pseudo-random state would be
      inherited by each forked child process.  The problem is masked to a
      considerable extent if the incoming connection uses SSL encryption, but
      when it does not, identical pseudo-random state is made available to
      functions like contrib/pgcrypto.  The process's PID does get mixed into any
      requested random output, but on most systems that still only results in 32K
      or so distinct random sequences available across all Postgres sessions.
      This might allow an attacker who has database access to guess the results
      of "secure" operations happening in another session.
      
      To fix, forcibly reset the PRNG after fork().  Each child process that has
      need for random numbers from OpenSSL's generator will thereby be forced to
      go through OpenSSL's normal initialization sequence, which should provide
      much greater variability of the sequences.  There are other ways we might
      do this that would be slightly cheaper, but this approach seems the most
      future-proof against SSL-related code changes.
      
      This has been assigned CVE-2013-1900, but since the issue and the patch
      have already been publicized on pgsql-hackers, there's no point in trying
      to hide this commit.
      
      Back-patch to all supported branches.
      
      Marko Kreen
      21ce40c8
    • Heikki Linnakangas's avatar
      Fix buffer pin leak in heap update redo routine. · 1b315c53
      Heikki Linnakangas authored
      In a heap update, if the old and new tuple were on different pages, and the
      new page no longer existed (because it was subsequently truncated away by
      vacuum), heap_xlog_update forgot to release the pin on the old buffer. This
      bug was introduced by the "Fix multiple problems in WAL replay" patch,
      commit 3bbf668d (on master branch).
      
      With full_page_writes=off, this triggered an "incorrect local pin count"
      error later in replay, if the old page was vacuumed.
      
      This fixes bug #7969, reported by Yunong Xiao. Backpatch to 9.0, like the
      commit that introduced this bug.
      1b315c53
  16. Mar 26, 2013
    • Tom Lane's avatar
      Ignore invalid indexes in pg_dump. · 96103c6a
      Tom Lane authored
      Dumping invalid indexes can cause problems at restore time, for example
      if the reason the index creation failed was because it tried to enforce
      a uniqueness condition not satisfied by the table's data.  Also, if the
      index creation is in fact still in progress, it seems reasonable to
      consider it to be an uncommitted DDL change, which pg_dump wouldn't be
      expected to dump anyway.
      
      Back-patch to all active versions, and teach them to ignore invalid
      indexes in servers back to 8.2, where the concept was introduced.
      
      Michael Paquier
      96103c6a
  17. Mar 25, 2013
    • Heikki Linnakangas's avatar
      In base backup, only include our own tablespace version directory. · 13f9634c
      Heikki Linnakangas authored
      If you have clusters of different versions pointing to the same tablespace
      location, we would incorrectly include all the data belonging to the other
      versions, too.
      
      Fixes bug #7986, reported by Sergey Burladyan.
      13f9634c
    • Heikki Linnakangas's avatar
      Add a server version check to pg_basebackup and pg_receivexlog. · 6980497f
      Heikki Linnakangas authored
      These programs don't work against 9.0 or earlier servers, so check that when
      the connection is made. That's better than a cryptic error message you got
      before.
      
      Also, these programs won't work with a 9.3 server, because the WAL streaming
      protocol was changed in a non-backwards-compatible way. As a general rule,
      we don't make any guarantee that an old client will work with a new server,
      so check that. However, allow a 9.1 client to connect to a 9.2 server, to
      avoid breaking environments that currently work; a 9.1 client happens to
      work with a 9.2 server, even though we didn't make any great effort to
      ensure that.
      
      This patch is for the 9.1 and 9.2 branches, I'll commit a similar patch to
      master later. Although this isn't a critical bug fix, it seems safe enough
      to back-patch. The error message you got when connecting to a 9.3devel
      server without this patch was cryptic enough to warrant backpatching.
      6980497f
  18. Mar 24, 2013
    • Tom Lane's avatar
      Update time zone abbreviation lists for changes missed since 2006. · 3a003c5a
      Tom Lane authored
      Most (all?) of Russia has moved to what's effectively year-round daylight
      savings time, so that the "standard" zone names now mean an hour later
      than they used to.  Update that, notably changing MSK as per recent
      complaint from Sergey Konoplev, but also CHOT, GET, IRKT, KGT, KRAT,
      MAGT, NOVT, OMST, VLAT, YAKT, YEKT.  The corresponding DST abbreviations
      are presumably now obsolete, but I left them in place with their old
      definitions, just to reduce any possible breakage from this change.
      
      Also add VOLT (Europe/Volgograd), which for some reason we never had
      before, as well as MIST (Antarctica/Macquarie), and fix obsolete
      definitions of MAWT, TKT, and WST.
      3a003c5a
  19. Mar 23, 2013
  20. Mar 22, 2013
    • Tom Lane's avatar
      Fix contrib/dblink to handle inconsistent DateStyle/IntervalStyle safely. · f2482061
      Tom Lane authored
      If the remote database's settings of these GUCs are different from ours,
      ambiguous datetime values may be read incorrectly.  To fix, temporarily
      adopt the remote server's settings while we ingest a query result.
      
      This is not a complete fix, since it doesn't do anything about ambiguous
      values in commands sent to the remote server; but there seems little we
      can do about that end of it given dblink's entirely textual API for
      transmitted commands.
      
      Back-patch to 9.2.  The hazard exists in all versions, but this patch
      would need more work to apply before 9.2.  Given the lack of field
      complaints about this issue, it doesn't seem worth the effort at present.
      
      Daniel Farina and Tom Lane
      f2482061
  21. Mar 18, 2013
    • Tom Lane's avatar
      Improve documentation of EXTRACT(WEEK). · b8f45997
      Tom Lane authored
      The docs showed that early-January dates can be considered part of the
      previous year for week-counting purposes, but failed to say explicitly
      that late-December dates can also be considered part of the next year.
      Fix that, and add a cross-reference to the "isoyear" field.  Per bug
      #7967 from Pawel Kobylak.
      b8f45997
  22. Mar 11, 2013
    • Tom Lane's avatar
      Fix race condition in DELETE RETURNING. · 32638960
      Tom Lane authored
      When RETURNING is specified, ExecDelete would return a virtual-tuple slot
      that could contain pointers into an already-unpinned disk buffer.  Another
      process could change the buffer contents before we get around to using the
      data, resulting in garbage results or even a crash.  This seems of fairly
      low probability, which may explain why there are no known field reports of
      the problem, but it's definitely possible.  Fix by forcing the result slot
      to be "materialized" before we release pin on the disk buffer.
      
      Back-patch to 9.0; in earlier branches there is no bug because
      ExecProcessReturning sent the tuple to the destination immediately.  Also,
      this is already fixed in HEAD as part of the writable-foreign-tables patch
      (where the fix is necessary for DELETE RETURNING to work at all with
      postgres_fdw).
      32638960
  23. Mar 07, 2013
    • Tom Lane's avatar
      Fix infinite-loop risk in fixempties() stage of regex compilation. · 957b9c0c
      Tom Lane authored
      The previous coding of this function could get into situations where it
      would never terminate, because successive passes would re-add EMPTY arcs
      that had been removed by the previous pass.  Rewrite the function
      completely using a new algorithm that is guaranteed to terminate, and
      also seems to be usually faster than the old one.  Per Tcl bugs 3604074
      and 3606683.
      
      Tom Lane and Don Porter
      957b9c0c
    • Heikki Linnakangas's avatar
      Fix tli history file fetching, broken by the archive after crash recevery patch. · 51616dcd
      Heikki Linnakangas authored
      If we were about to enter archive recovery after crash recovery, we scanned
      the archive for the latest tli history file, and set the recovery target
      timeline to that. However, when we actually tried to read the history file,
      we would not fetch the file from the archive, because we were not in archive
      recovery yet.
      
      To fix, make readTimeLineHistory and existsTimeLineHistory to always fetch
      the file from archive if archive recovery is requested, even if we're not in
      archive recovery yet.
      
      Backpatch to 9.2. Mitsumasa KONDO
      51616dcd
    • Heikki Linnakangas's avatar
      Further fix to the mode where we enter archive recovery after crash recovery. · d009f903
      Heikki Linnakangas authored
      I missed to returns in the middle of ReadRecord function in my previous fix.
      If a WAL file was not found at all during crash recovery, XLogPageRead would
      return 'false', and ReadRecord would return without entering archive recovery.
      
      9.2 only. In master, the code is structured differently and does not have this
      problem.
      
      Kyotaro HORIGUCHI, Mitsumasa KONDO and me.
      d009f903
  24. Mar 06, 2013
Loading