Skip to content
Snippets Groups Projects
  1. Dec 29, 2009
  2. Dec 21, 2009
  3. Dec 19, 2009
    • Simon Riggs's avatar
      Allow read only connections during recovery, known as Hot Standby. · efc16ea5
      Simon Riggs authored
      Enabled by recovery_connections = on (default) and forcing archive recovery using a recovery.conf. Recovery processing now emulates the original transactions as they are replayed, providing full locking and MVCC behaviour for read only queries. Recovery must enter consistent state before connections are allowed, so there is a delay, typically short, before connections succeed. Replay of recovering transactions can conflict and in some cases deadlock with queries during recovery; these result in query cancellation after max_standby_delay seconds have expired. Infrastructure changes have minor effects on normal running, though introduce four new types of WAL record.
      
      New test mode "make standbycheck" allows regression tests of static command behaviour on a standby server while in recovery. Typical and extreme dynamic behaviours have been checked via code inspection and manual testing. Few port specific behaviours have been utilised, though primary testing has been on Linux only so far.
      
      This commit is the basic patch. Additional changes will follow in this release to enhance some aspects of behaviour, notably improved handling of conflicts, deadlock detection and query cancellation. Changes to VACUUM FULL are also required.
      
      Simon Riggs, with significant and lengthy review by Heikki Linnakangas, including streamlined redesign of snapshot creation and two-phase commit.
      
      Important contributions from Florian Pflug, Mark Kirkwood, Merlin Moncure, Greg Stark, Gianni Ciolli, Gabriele Bartolini, Hannu Krosing, Robert Haas, Tatsuo Ishii, Hiroyuki Yamada plus support and feedback from many other community members.
      efc16ea5
    • Bruce Momjian's avatar
      binary migration: pg_migrator · 78a09145
      Bruce Momjian authored
      Add comments about places where system oids have to be preserved for
      binary migration.
      78a09145
  4. Dec 15, 2009
    • Tom Lane's avatar
      Support ORDER BY within aggregate function calls, at long last providing a · 34d26872
      Tom Lane authored
      non-kluge method for controlling the order in which values are fed to an
      aggregate function.  At the same time eliminate the old implementation
      restriction that DISTINCT was only supported for single-argument aggregates.
      
      Possibly release-notable behavioral change: formerly, agg(DISTINCT x)
      dropped null values of x unconditionally.  Now, it does so only if the
      agg transition function is strict; otherwise nulls are treated as DISTINCT
      normally would, ie, you get one copy.
      
      Andrew Gierth, reviewed by Hitoshi Harada
      34d26872
  5. Dec 12, 2009
  6. Dec 11, 2009
  7. Dec 09, 2009
    • Tom Lane's avatar
      Prevent indirect security attacks via changing session-local state within · 62aba765
      Tom Lane authored
      an allegedly immutable index function.  It was previously recognized that
      we had to prevent such a function from executing SET/RESET ROLE/SESSION
      AUTHORIZATION, or it could trivially obtain the privileges of the session
      user.  However, since there is in general no privilege checking for changes
      of session-local state, it is also possible for such a function to change
      settings in a way that might subvert later operations in the same session.
      Examples include changing search_path to cause an unexpected function to
      be called, or replacing an existing prepared statement with another one
      that will execute a function of the attacker's choosing.
      
      The present patch secures VACUUM, ANALYZE, and CREATE INDEX/REINDEX against
      these threats, which are the same places previously deemed to need protection
      against the SET ROLE issue.  GUC changes are still allowed, since there are
      many useful cases for that, but we prevent security problems by forcing a
      rollback of any GUC change after completing the operation.  Other cases are
      handled by throwing an error if any change is attempted; these include temp
      table creation, closing a cursor, and creating or deleting a prepared
      statement.  (In 7.4, the infrastructure to roll back GUC changes doesn't
      exist, so we settle for rejecting changes of "search_path" in these contexts.)
      
      Original report and patch by Gurjeet Singh, additional analysis by
      Tom Lane.
      
      Security: CVE-2009-4136
      62aba765
  8. Dec 07, 2009
  9. Dec 05, 2009
    • Peter Eisentraut's avatar
      Speed up information schema privilege views · 36f887c4
      Peter Eisentraut authored
      Instead of expensive cross joins to resolve the ACL, add table-returning
      function aclexplode() that expands the ACL into a useful form, and join
      against that.
      
      Also, implement the role_*_grants views as a thin layer over the respective
      *_privileges views instead of essentially repeating the same code twice.
      
      fixes bug #4596
      
      by Joachim Wieland, with cleanup by me
      36f887c4
  10. Nov 29, 2009
  11. Nov 20, 2009
    • Tom Lane's avatar
      Add a WHEN clause to CREATE TRIGGER, allowing a boolean expression to be · 7fc0f062
      Tom Lane authored
      checked to determine whether the trigger should be fired.
      
      For BEFORE triggers this is mostly a matter of spec compliance; but for AFTER
      triggers it can provide a noticeable performance improvement, since queuing of
      a deferred trigger event and re-fetching of the row(s) at end of statement can
      be short-circuited if the trigger does not need to be fired.
      
      Takahiro Itagaki, reviewed by KaiGai Kohei.
      7fc0f062
  12. Nov 10, 2009
  13. Nov 06, 2009
  14. Nov 05, 2009
  15. Oct 28, 2009
    • Tom Lane's avatar
      Un-break EXPLAIN for Append plans. I messed this up a few days ago while · 77c666fe
      Tom Lane authored
      adding the ModifyTable node type --- I had been thinking ModifyTable should
      replace Append as a special case in push_plan(), but actually both of them
      have to be special-cased.
      77c666fe
    • Tom Lane's avatar
      Fix AcquireRewriteLocks to be sure that it acquires the right lock strength · cbcd1701
      Tom Lane authored
      when FOR UPDATE is propagated down into a sub-select expanded from a view.
      Similar bug to parser's isLockedRel issue that I fixed yesterday; likewise
      seems not quite worth the effort to back-patch.
      cbcd1701
    • Tom Lane's avatar
      When FOR UPDATE/SHARE is used with LIMIT, put the LockRows plan node · 46e3a16b
      Tom Lane authored
      underneath the Limit node, not atop it.  This fixes the old problem that such
      a query might unexpectedly return fewer rows than the LIMIT says, due to
      LockRows discarding updated rows.
      
      There is a related problem that LockRows might destroy the sort ordering
      produced by earlier steps; but fixing that by pushing LockRows below Sort
      would create serious performance problems that are unjustified in many
      real-world applications, as well as potential deadlock problems from locking
      many more rows than expected.  Instead, keep the present semantics of applying
      FOR UPDATE after ORDER BY within a single query level; but allow the user to
      specify the other way by writing FOR UPDATE in a sub-select.  To make that
      work, track whether FOR UPDATE appeared explicitly in sub-selects or got
      pushed down from the parent, and don't flatten a sub-select that contained an
      explicit FOR UPDATE.
      46e3a16b
  16. Oct 26, 2009
    • Heikki Linnakangas's avatar
      Fix range check in date_recv that tried to limit accepted values to only · 2078e384
      Heikki Linnakangas authored
      those accepted by date_in(). I confused julian day numbers and number of
      days since the postgres epoch 2000-01-01 in the original patch.
      
      I just noticed that it's still easy to get such out-of-range values into
      the database using to_date or +- operators, but this patch doesn't do
      anything about those functions.
      
      Per report from James Pye.
      2078e384
  17. Oct 21, 2009
    • Tom Lane's avatar
      Remove regex_flavor GUC, so that regular expressions are always "advanced" · ab61df9e
      Tom Lane authored
      style by default.  Per discussion, there seems to be hardly anything that
      really relies on being able to change the regex flavor, so the ability to
      select it via embedded options ought to be enough for any stragglers.
      Also, if we didn't remove the GUC, we'd really be morally obligated to
      mark the regex functions non-immutable, which'd possibly create performance
      issues.
      ab61df9e
  18. Oct 15, 2009
    • Tom Lane's avatar
      Support SQL-compliant triggers on columns, ie fire only if certain columns · b2734a0d
      Tom Lane authored
      are named in the UPDATE's SET list.
      
      Note: the schema of pg_trigger has not actually changed; we've just started
      to use a column that was there all along.  catversion bumped anyway so that
      this commit is included in the history of potentially interesting changes
      to system catalog contents.
      
      Itagaki Takahiro
      b2734a0d
  19. Oct 13, 2009
    • Tom Lane's avatar
      Fix ts_stat's failure on empty tsvector. · b1407116
      Tom Lane authored
      Also insert a couple of Asserts that check for stack overflow.
      Bogus coding appears to be new in 8.4 --- older releases had a much
      simpler algorithm here.  Per bug #5111.
      b1407116
  20. Oct 10, 2009
    • Tom Lane's avatar
      Improve similar_escape() in two different ways: · 05d24971
      Tom Lane authored
      * Stop escaping ? and {.  As of SQL:2008, SIMILAR TO is defined to have
      POSIX-compatible interpretation of ? as well as {m,n} and related constructs,
      so we should allow these things through to our regex engine.
      
      * Escape ^ and $.  It appears that our regex engine will treat ^^ at the
      beginning of the string the same as ^, and similarly for $$ at the end of
      the string, which meant that SIMILAR TO was effectively ignoring ^ at the
      start of the pattern and $ at the end.  Since these are not supposed to be
      metacharacters, this is a bug.
      
      The second part of this is arguably a back-patchable bug fix, but I'm
      hesitant to do that because it might break applications that are expecting
      something like "col SIMILAR TO '^foo$'" to work like a POSIX pattern.
      Seems safer to only change it at a major version boundary.
      
      Per discussion of an example from Doug Gorley.
      05d24971
    • Tom Lane's avatar
      Split the processing of INSERT/UPDATE/DELETE operations out of execMain.c. · 8a5849b7
      Tom Lane authored
      They are now handled by a new plan node type called ModifyTable, which is
      placed at the top of the plan tree.  In itself this change doesn't do much,
      except perhaps make the handling of RETURNING lists and inherited UPDATEs a
      tad less klugy.  But it is necessary preparation for the intended extension of
      allowing RETURNING queries inside WITH.
      
      Marko Tiikkaja
      8a5849b7
  21. Oct 09, 2009
    • Peter Eisentraut's avatar
      Use pg_get_triggerdef in pg_dump · b865d275
      Peter Eisentraut authored
      Add a variant of pg_get_triggerdef with a second argument "pretty" that
      causes the output to be formatted in the way pg_dump used to do.  Use this
      variant in pg_dump with server versions >= 8.5.
      
      This insulates pg_dump from most future trigger feature additions, such as
      the upcoming column triggers patch.
      
      Author: Itagaki Takahiro <itagaki.takahiro@oss.ntt.co.jp>
      b865d275
  22. Oct 08, 2009
  23. Oct 05, 2009
    • Tom Lane's avatar
      Create an ALTER DEFAULT PRIVILEGES command, which allows users to adjust · 249724cb
      Tom Lane authored
      the privileges that will be applied to subsequently-created objects.
      
      Such adjustments are always per owning role, and can be restricted to objects
      created in particular schemas too.  A notable benefit is that users can
      override the traditional default privilege settings, eg, the PUBLIC EXECUTE
      privilege traditionally granted by default for functions.
      
      Petr Jelinek
      249724cb
  24. Sep 11, 2009
  25. Sep 09, 2009
    • Peter Eisentraut's avatar
      Fix/improve bytea and boolean support in PL/Python · 3ab8b7fa
      Peter Eisentraut authored
      Before, PL/Python converted data between SQL and Python by going
      through a C string representation.  This broke for bytea in two ways:
      
      - On input (function parameters), you would get a Python string that
        contains bytea's particular external representation with backslashes
        etc., instead of a sequence of bytes, which is what you would expect
        in a Python environment.  This problem is exacerbated by the new
        bytea output format.
      
      - On output (function return value), null bytes in the Python string
        would cause truncation before the data gets stored into a bytea
        datum.
      
      This is now fixed by converting directly between the PostgreSQL datum
      and the Python representation.
      
      The required generalized infrastructure also allows for other
      improvements in passing:
      
      - When returning a boolean value, the SQL datum is now true if and
        only if Python considers the value that was passed out of the
        PL/Python function to be true.  Previously, this determination was
        left to the boolean data type input function.  So, now returning
        'foo' results in true, because Python considers it true, rather than
        false because PostgreSQL considers it false.
      
      - On input, we can convert the integer and float types directly to
        their Python equivalents without having to go through an
        intermediate string representation.
      
      original patch by Caleb Welton, with updates by myself
      3ab8b7fa
  26. Sep 04, 2009
  27. Sep 03, 2009
    • Tom Lane's avatar
      Install a workaround for a longstanding gcc bug that allows SIGFPE traps · d0a368c6
      Tom Lane authored
      to occur for division by zero, even though the code is carefully avoiding
      that.  All available evidence is that the only functions affected are
      int24div, int48div, and int28div, so patch just those three functions to
      include a "return" after the ereport() call.
      
      Backpatch to 8.4 so that the fix can be tested in production builds.
      For older branches our recommendation will continue to be to use -O1
      on affected platforms (which are mostly non-mainstream anyway).
      d0a368c6
  28. Aug 30, 2009
  29. Aug 27, 2009
  30. Aug 18, 2009
  31. Aug 10, 2009
Loading