1. 02 10月, 2011 1 次提交
    • T
      Improve generated column names for cases involving sub-SELECTs. · 5ec6b7f1
      Tom Lane 提交于
      We'll now use "exists" for EXISTS(SELECT ...), "array" for ARRAY(SELECT
      ...), or the sub-select's own result column name for a simple expression
      sub-select.  Previously, you usually got "?column?" in such cases.
      
      Marti Raudsepp, reviewed by Kyotaro Horiugchi
      5ec6b7f1
  2. 28 9月, 2011 2 次提交
  3. 27 9月, 2011 2 次提交
    • T
      Fix window functions that sort by expressions involving aggregates. · 269c5dd2
      Tom Lane 提交于
      In commit c1d9579d, I changed things so
      that the output of the Agg node that feeds the window functions would not
      list any ungrouped Vars directly.  Formerly, for example, the Agg tlist
      might have included both "x" and "sum(x)", which is not really valid if
      "x" isn't a grouping column.  If we then had a window function ordering on
      something like "sum(x) + 1", prepare_sort_from_pathkeys would find no exact
      match for this in the Agg tlist, and would conclude that it must recompute
      the expression.  But it would break the expression down to just the Var
      "x", which it would find in the tlist, and then rebuild the ORDER BY
      expression using a reference to the subplan's "x" output.  Now, after the
      above-referenced changes, "x" isn't in the Agg tlist if it's not a grouping
      column, so that prepare_sort_from_pathkeys fails with "could not find
      pathkey item to sort", as reported by Bricklen Anderson.
      
      The fix is to not break down Aggrefs into their component parts, but just
      treat them as irreducible expressions to be sought in the subplan tlist.
      This is definitely OK for the use with respect to window functions in
      grouping_planner, since it just built the tlist being used on the same
      basis.  AFAICT it is safe for other uses too; most of the other call sites
      couldn't encounter Aggrefs anyway.
      269c5dd2
    • T
      Speed up array element assignment in plpgsql by caching type information. · 16762b51
      Tom Lane 提交于
      Cache assorted data in the PLpgSQL_arrayelem struct to avoid repetitive
      catalog lookups over multiple executions of the same statement.
      
      Pavel Stehule
      16762b51
  4. 21 9月, 2011 1 次提交
    • R
      Fix another bit of unlogged-table-induced breakage. · 4893552e
      Robert Haas 提交于
      Per bug #6205, reported by Abel Abraham Camarillo Ojeda.  This isn't a
      particularly elegant fix, but I'm trying to minimize the chances of
      causing yet another round of breakage.
      
      Adjust regression tests to exercise this case.
      4893552e
  5. 16 9月, 2011 1 次提交
    • T
      Redesign the plancache mechanism for more flexibility and efficiency. · e6faf910
      Tom Lane 提交于
      Rewrite plancache.c so that a "cached plan" (which is rather a misnomer
      at this point) can support generation of custom, parameter-value-dependent
      plans, and can make an intelligent choice between using custom plans and
      the traditional generic-plan approach.  The specific choice algorithm
      implemented here can probably be improved in future, but this commit is
      all about getting the mechanism in place, not the policy.
      
      In addition, restructure the API to greatly reduce the amount of extraneous
      data copying needed.  The main compromise needed to make that possible was
      to split the initial creation of a CachedPlanSource into two steps.  It's
      worth noting in particular that SPI_saveplan is now deprecated in favor of
      SPI_keepplan, which accomplishes the same end result with zero data
      copying, and no need to then spend even more cycles throwing away the
      original SPIPlan.  The risk of long-term memory leaks while manipulating
      SPIPlans has also been greatly reduced.  Most of this improvement is based
      on use of the recently-added MemoryContextSetParent primitive.
      e6faf910
  6. 08 9月, 2011 1 次提交
    • T
      Fix corner case bug in numeric to_char(). · f0bedf3e
      Tom Lane 提交于
      Trailing-zero stripping applied by the FM specifier could strip zeroes
      to the left of the decimal point, for a format with no digit positions
      after the decimal point (such as "FM999.").
      
      Reported and diagnosed by Marti Raudsepp, though I didn't use his patch.
      f0bedf3e
  7. 01 9月, 2011 1 次提交
    • R
      Minor improvements to mbregress.sh script. · 48fb49e3
      Robert Haas 提交于
      1. Use new dropdb --if-exists option, to avoid alarming the user if
         the database being dropped doesn't already exist.
      2. Bail out if createdb fails.
      3. exit 1 if the checks fail.
      4. Make it executable.
      
      Josh Kupershmidt, with some kibitzing by me.
      48fb49e3
  8. 31 8月, 2011 1 次提交
  9. 30 8月, 2011 1 次提交
  10. 26 8月, 2011 3 次提交
  11. 25 8月, 2011 1 次提交
  12. 24 8月, 2011 1 次提交
  13. 22 8月, 2011 3 次提交
  14. 21 8月, 2011 1 次提交
  15. 18 8月, 2011 3 次提交
  16. 15 8月, 2011 1 次提交
  17. 11 8月, 2011 1 次提交
  18. 09 8月, 2011 2 次提交
    • T
      Fix nested PlaceHolderVar expressions that appear only in targetlists. · 77ba2325
      Tom Lane 提交于
      A PlaceHolderVar's expression might contain another, lower-level
      PlaceHolderVar.  If the outer PlaceHolderVar is used, the inner one
      certainly will be also, and so we have to make sure that both of them get
      into the placeholder_list with correct ph_may_need values during the
      initial pre-scan of the query (before deconstruct_jointree starts).
      We did this correctly for PlaceHolderVars appearing in the query quals,
      but overlooked the issue for those appearing in the top-level targetlist;
      with the result that nested placeholders referenced only in the targetlist
      did not work correctly, as illustrated in bug #6154.
      
      While at it, add some error checking to find_placeholder_info to ensure
      that we don't try to create new placeholders after it's too late to do so;
      they have to all be created before deconstruct_jointree starts.
      
      Back-patch to 8.4 where the PlaceHolderVar mechanism was introduced.
      77ba2325
    • R
      Teach psql to display the comments on SQL/MED objects in verbose mode. · d82a9d2a
      Robert Haas 提交于
      The relevant backslash commands already exist, so we're just adding an
      additional column.  With this commit, all objects that have psql backslash
      commands and accept comments should now display those comments at least
      in verbose mode.
      
      Josh Kupershmidt, with doc additions by me.
      d82a9d2a
  19. 06 8月, 2011 1 次提交
  20. 23 7月, 2011 1 次提交
    • R
      Unbreak unlogged tables. · 6f1be5a6
      Robert Haas 提交于
      I broke this in commit 5da79169, which
      was obviously insufficiently well tested.  Add some regression tests
      in the hope of making future slip-ups more likely to be noticed.
      6f1be5a6
  21. 21 7月, 2011 4 次提交
    • T
      Make xpath() do something useful with XPath expressions that return scalars. · 0ce7676a
      Tom Lane 提交于
      Previously, xpath() simply returned an empty array if the expression did
      not yield a node set.  This is useless for expressions that return scalars,
      such as one with name() at the top level.  Arrange to return the scalar
      value as a single-element xml array, instead.  (String values will be
      suitably escaped.)
      
      This change will also cause xpath_exists() to return true, not false,
      for such expressions.
      
      Florian Pflug, reviewed by Radoslaw Smogura
      0ce7676a
    • T
      Ensure that xpath() escapes special characters in string values. · aaf15e5c
      Tom Lane 提交于
      Without this it's possible for the output to not be legal XML, as
      illustrated by the added regression test cases.
      
      NB: this change will need to be called out as an incompatibility in the
      9.2 release notes, since it's possible somebody was relying on the old
      behavior, even though it's clearly wrong.
      
      Florian Pflug, reviewed by Radoslaw Smogura
      aaf15e5c
    • R
      Support SECURITY LABEL on databases, tablespaces, and roles. · 463f2625
      Robert Haas 提交于
      This requires a new shared catalog, pg_shseclabel.
      
      Along the way, fix the security_label regression tests so that they
      don't monkey with the labels of any pre-existing objects.  This is
      unlikely to matter in practice, since only the label for the "dummy"
      provider was being manipulated.  But this way still seems cleaner.
      
      KaiGai Kohei, with fairly extensive hacking by me.
      463f2625
    • T
      Rewrite libxml error handling to be more robust. · cacd42d6
      Tom Lane 提交于
      libxml reports some errors (like invalid xmlns attributes) via the error
      handler hook, but still returns a success indicator to the library caller.
      This causes us to miss some errors that are important to report.  Since the
      "generic" error handler hook doesn't know whether the message it's getting
      is for an error, warning, or notice, stop using that and instead start
      using the "structured" error handler hook, which gets enough information
      to be useful.
      
      While at it, arrange to save and restore the error handler hook setting in
      each libxml-using function, rather than assuming we can set and forget the
      hook.  This should improve the odds of working nicely with third-party
      libraries that also use libxml.
      
      In passing, volatile-ize some local variables that get modified within
      PG_TRY blocks.  I noticed this while testing with an older gcc version
      than I'd previously tried to compile xml.c with.
      
      Florian Pflug and Tom Lane, with extensive review/testing by Noah Misch
      cacd42d6
  22. 20 7月, 2011 3 次提交
    • A
      Make isolationtester more robust on locked commands · c8dfc892
      Alvaro Herrera 提交于
      Noah Misch diagnosed the buildfarm problems in the isolation tests
      partly as failure to differentiate backends properly; the old code was
      using backend IDs, which is not good enough because a new backend might
      use an already used ID.  Use PIDs instead.
      
      Also, the code was purposely careless about other concurrent activity,
      because it isn't expected; and in fact, it doesn't affect the vast
      majority of the time.  However, it can be observed that autovacuum can
      block tables for long enough to cause sporadic failures.  The new code
      accounts for that by ignoring locks held by processes not explicitly
      declared in our spec file.
      
      Author: Noah Misch
      c8dfc892
    • A
      Increase deadlock_timeout to 100ms in FK isolation tests · d6db0e4e
      Alvaro Herrera 提交于
      The previous value of 20ms is dangerously close to the time actually
      spent just waiting for the deadlock to happen, so on occasion it causes
      the test to fail simply because the other session didn't get to run
      early enough, not managing to cause the deadlock that needs to be
      detected.  With this new value, it's expected that most machines on
      normal load will be able to pass the test.
      
      Author: Noah Misch
      d6db0e4e
    • A
      Add expected regress output on stricter isolation levels · a0eae1a2
      Alvaro Herrera 提交于
      These new files allow the new FK tests on isolationtester to pass on the
      serializable and repeatable read isolation levels (which are untested
      by the buildfarm).
      
      Author: Kevin Grittner
      Reviewed by Noah Misch
      a0eae1a2
  23. 19 7月, 2011 2 次提交
  24. 18 7月, 2011 1 次提交
    • R
      Create a "fast path" for acquiring weak relation locks. · 3cba8999
      Robert Haas 提交于
      When an AccessShareLock, RowShareLock, or RowExclusiveLock is requested
      on an unshared database relation, and we can verify that no conflicting
      locks can possibly be present, record the lock in a per-backend queue,
      stored within the PGPROC, rather than in the primary lock table.  This
      eliminates a great deal of contention on the lock manager LWLocks.
      
      This patch also refactors the interface between GetLockStatusData() and
      pg_lock_status() to be a bit more abstract, so that we don't rely so
      heavily on the lock manager's internal representation details.  The new
      fast path lock structures don't have a LOCK or PROCLOCK structure to
      return, so we mustn't depend on that for purposes of listing outstanding
      locks.
      
      Review by Jeff Davis.
      3cba8999
  25. 16 7月, 2011 1 次提交