1. 29 Jan, 2012 3 commits
    • Tom Lane's avatar
      Add caution about multiple unique indexes breaking plpgsql upsert example. · ed6e0545
      Tom Lane authored
      Per Phil Sorber, though I didn't use his wording exactly.
      ed6e0545
    • Tom Lane's avatar
      Update statement about sorting of character-string data. · 17d3233e
      Tom Lane authored
      The sort order is no longer fixed at database creation time, but can be
      controlled via COLLATE.  Noted by Thomas Kellerer.
      17d3233e
    • Tom Lane's avatar
      Fix handling of init_plans list in inheritance_planner(). · 4ec6581c
      Tom Lane authored
      Formerly we passed an empty list to each per-child-table invocation of
      grouping_planner, and then merged the results into the global list.
      However, that fails if there's a CTE attached to the statement, because
      create_ctescan_plan uses the list to find the plan referenced by a CTE
      reference; so it was unable to find any CTEs attached to the outer UPDATE
      or DELETE.  But there's no real reason not to use the same list throughout
      the process, and doing so is simpler and faster anyway.
      
      Per report from Josh Berkus of "could not find plan for CTE" failures.
      Back-patch to 9.1 where we added support for WITH attached to UPDATE or
      DELETE.  Add some regression test cases, too.
      4ec6581c
  2. 28 Jan, 2012 6 commits
    • Tom Lane's avatar
      Add simple tests of EvalPlanQual using the isolationtester infrastructure. · 759d9d67
      Tom Lane authored
      Much more could be done here, but at least now we have *some* automated
      test coverage of that mechanism.  In particular this tests the writable-CTE
      case reported by Phil Sorber.
      
      In passing, remove isolationtester's arbitrary restriction on the number of
      steps in a permutation list.  I used this so that a single spec file could
      be used to run several related test scenarios, but there are other possible
      reasons to want a step series that's not exactly a permutation.  Improve
      documentation and fix a couple other nits as well.
      759d9d67
    • Tom Lane's avatar
      Fix handling of data-modifying CTE subplans in EvalPlanQual. · 7c1719bc
      Tom Lane authored
      We can't just skip initializing such subplans, because the referencing CTE
      node will expect to find the subplan available when it initializes.  That
      in turn means that ExecInitModifyTable must allow the case (which actually
      it needed to do anyway, since there's no guarantee that ModifyTable is
      exactly at the top of the CTE plan tree).  So move the complaint about not
      being allowed in EvalPlanQual mode to execution instead of initialization.
      Testing turned up yet another problem, which is that we'd try to
      re-initialize the result relation's index list, leading to leaks and
      dangling pointers.
      
      Per report from Phil Sorber.  Back-patch to 9.1 where data-modifying CTEs
      were introduced.
      7c1719bc
    • Magnus Hagander's avatar
      Prevent logging "failed to stat file: success" for temp files · 672614cf
      Magnus Hagander authored
      This was broken in commit bc334748, the
      addition of statistics counters for temp files.
      
      Reported by Thom Brown
      672614cf
    • Tom Lane's avatar
      Fix error detection in contrib/pgcrypto's encrypt_iv() and decrypt_iv(). · a8b4b843
      Tom Lane authored
      Due to oversights, the encrypt_iv() and decrypt_iv() functions failed to
      report certain types of invalid-input errors, and would instead return
      random garbage values.
      
      Marko Kreen, per report from Stefan Kaltenbrunner
      a8b4b843
    • Tom Lane's avatar
      Undo 8.4-era lobotomization of subquery pullup rules. · 0816fad6
      Tom Lane authored
      After the planner was fixed to convert some IN/EXISTS subqueries into
      semijoins or antijoins, we had to prevent it from doing that in some
      cases where the plans risked getting much worse.  The reason the plans
      got worse was that in the unoptimized implementation, subqueries could
      reference parameters from the outer query at any join level, and so
      full table scans could be avoided even if they were one or more levels
      of join below where the semi/anti join would be.  Now that we have
      sufficient mechanism in the planner to handle such cases properly,
      it should no longer be necessary to play dumb here.
      
      This reverts commits 07b9936a and
      cd1f0d04.  The latter was a stopgap
      fix that wasn't really sufficiently analyzed at the time.  Rather
      than just restricting ourselves to cases where the new join can be
      stacked on the right-hand input, we should also consider whether it
      can be stacked on the left-hand input.
      0816fad6
    • Tom Lane's avatar
      Use parameterized paths to generate inner indexscans more flexibly. · e2fa76d8
      Tom Lane authored
      This patch fixes the planner so that it can generate nestloop-with-
      inner-indexscan plans even with one or more levels of joining between
      the indexscan and the nestloop join that is supplying the parameter.
      The executor was fixed to handle such cases some time ago, but the
      planner was not ready.  This should improve our plans in many situations
      where join ordering restrictions formerly forced complete table scans.
      
      There is probably a fair amount of tuning work yet to be done, because
      of various heuristics that have been added to limit the number of
      parameterized paths considered.  However, we are not going to find out
      what needs to be adjusted until the code gets some real-world use, so
      it's time to get it in there where it can be tested easily.
      
      Note API change for index AM amcostestimate functions.  I'm not aware of
      any non-core index AMs, but if there are any, they will need minor
      adjustments.
      e2fa76d8
  3. 27 Jan, 2012 13 commits
  4. 26 Jan, 2012 11 commits
  5. 25 Jan, 2012 7 commits