1. 27 Jul, 2009 4 commits
  2. 26 Jul, 2009 1 commit
    • Tom Lane's avatar
      Extend EXPLAIN to allow generic options to be specified. · d4382c4a
      Tom Lane authored
      The original syntax made it difficult to add options without making them
      into reserved words.  This change parenthesizes the options to avoid that
      problem, and makes provision for an explicit (and perhaps non-Boolean)
      value for each option.  The original syntax is still supported, but only
      for the two original options ANALYZE and VERBOSE.
      
      As a test case, add a COSTS option that can suppress the planner cost
      estimates.  This may be useful for including EXPLAIN output in the regression
      tests, which are otherwise unable to cope with cross-platform variations in
      cost estimates.
      
      Robert Haas
      d4382c4a
  3. 25 Jul, 2009 3 commits
  4. 24 Jul, 2009 5 commits
    • Tom Lane's avatar
      Assorted minor refactoring in EXPLAIN. · 8af12bca
      Tom Lane authored
      This is believed to not change the output at all, with one known exception:
      "Subquery Scan foo" becomes "Subquery Scan on foo".  (We can fix that if
      anyone complains, but it would be a wart, because the old code was clearly
      inconsistent.)  The main intention is to remove duplicate coding and
      provide a cleaner base for subsequent EXPLAIN patching.
      
      Robert Haas
      8af12bca
    • Magnus Hagander's avatar
      Reserve the shared memory region during backend startup on Windows, so · a7e58786
      Magnus Hagander authored
      that memory allocated by starting third party DLLs doesn't end up
      conflicting with it.
      
      Hopefully this solves the long-time issue with "could not reattach
      to shared memory" errors on Win32.
      
      Patch from Tsutomu Yamada and me, based on idea from Trevor Talbot.
      a7e58786
    • Peter Eisentraut's avatar
      Document \dg+ and \du+ · 5e229941
      Peter Eisentraut authored
      The fact that \dg and \du take the + option was missing in the documentation.
      
      backpatched to 8.4
      
      Author: Andreas Wenk <a.wenk@netzmeister-st-pauli.de>
      5e229941
    • Tom Lane's avatar
      Avoid extra system calls to block SIGPIPE if the platform provides either · cea80e72
      Tom Lane authored
      sockopt(SO_NOSIGPIPE) or the MSG_NOSIGNAL flag to send().
      
      We assume these features are available if (1) the symbol is defined at
      compile time and (2) the kernel doesn't reject the call at runtime.
      It might turn out that there are some platforms where (1) and (2) are
      true and yet the signal isn't really blocked, in which case applications
      would die on server crash.  If that sort of thing gets reported, then
      we'll have to add additional defenses of some kind.
      
      Jeremy Kerr
      cea80e72
    • Tom Lane's avatar
  5. 23 Jul, 2009 6 commits
    • Andrew Dunstan's avatar
      Force use of our erand48 on Cygwin · dc7aa365
      Andrew Dunstan authored
      dc7aa365
    • Tom Lane's avatar
      Teach pg_dump to dump comments attached to the columns of a composite type. · 0d6909ea
      Tom Lane authored
      Taro Minowa (Higepon)
      0d6909ea
    • Tom Lane's avatar
      Save a few cycles in EXPLAIN and related commands by not bothering to form · adfa0429
      Tom Lane authored
      a physical tuple in do_tup_output().  A virtual tuple is easier to set up
      and also easier for most tuple receivers to process.  Per my comment on
      Robert Haas' recent patch in this code.
      adfa0429
    • Tom Lane's avatar
      In a non-hashed Agg node, reset the "aggcontext" at group boundaries, instead · 6a0865e4
      Tom Lane authored
      of individually pfree'ing pass-by-reference transition values.  This should
      be at least as fast as the prior coding, and it has the major advantage of
      clearing out any working data an aggregate function may have stored in or
      underneath the aggcontext.  This avoids memory leakage when an aggregate
      such as array_agg() is used in GROUP BY mode.  Per report from Chris Spotts.
      
      Back-patch to 8.4.  In principle the problem could arise in prior versions,
      but since they didn't have array_agg the issue seems not critical.
      6a0865e4
    • Tom Lane's avatar
      Fix another thinko in join_is_legal's handling of semijoins: we have to test · 1ca695db
      Tom Lane authored
      for the case that the semijoin was implemented within either input by
      unique-ifying its RHS before we test to see if it appears to match the current
      join situation.  The previous coding would select semijoin logic in situations
      where we'd already unique-ified the RHS and joined it to some unrelated
      relation(s), and then came to join it to the semijoin's LHS.  That still gave
      the right answer as far as the semijoin itself was concerned, but would lead
      to incorrectly examining only an arbitrary one of the matchable rows from the
      unrelated relation(s).  The cause of this thinko was incorrect unification of
      the pre-8.4 logic for IN joins and OUTER joins --- the comparable case for
      outer joins can be handled after making the match test, but that's because
      there is nothing like the unique-ification escape hatch for outer joins.
      Per bug #4934 from Benjamin Reed.
      1ca695db
    • Andrew Dunstan's avatar
  6. 22 Jul, 2009 5 commits
  7. 21 Jul, 2009 6 commits
  8. 20 Jul, 2009 7 commits
  9. 19 Jul, 2009 2 commits
    • Tom Lane's avatar
      Rewrite GEQO's gimme_tree function so that it always finds a legal join · 400e2c93
      Tom Lane authored
      sequence, even when the input "tour" doesn't lead directly to such a sequence.
      The stack logic that was added in 2004 only supported cases where relations
      that had to be joined to each other (due to join order restrictions) were
      adjacent in the tour.  However, relying on a random search to figure that out
      is tremendously inefficient in large join problems, and could even fail
      completely (leading to "failed to make a valid plan" errors) if
      random_init_pool ran out of patience.  It seems better to make the
      tour-to-plan transformation a little bit fuzzier so that every tour can form
      a legal plan, even though this means that apparently different tours will
      sometimes yield the same plan.
      
      In the same vein, get rid of the logic that knew that tours (a,b,c,d,...)
      are the same as tours (b,a,c,d,...), and therefore insisted the latter
      are invalid.  The chance of generating two tours that differ only in
      this way isn't that high, and throwing out 50% of possible tours to
      avoid such duplication seems more likely to waste valuable genetic-
      refinement generations than to do anything useful.
      
      This leaves us with no cases in which geqo_eval will deem a tour invalid,
      so get rid of assorted kluges that tried to deal with such cases, in
      particular the undocumented assumption that DBL_MAX is an impossible
      plan cost.
      
      This is all per testing of Robert Haas' lets-remove-the-collapse-limits
      patch.  That idea has crashed and burned, at least for now, but we still
      got something useful out of it.
      
      It's possible we should back-patch this change, since the "failed to make a
      valid plan" error can happen in existing releases; but I'd rather not until
      it has gotten more testing.
      400e2c93
    • Tom Lane's avatar
      Fix a thinko in join_is_legal: when we decide we can implement a semijoin · a43b190e
      Tom Lane authored
      by unique-ifying the RHS and then inner-joining to some other relation,
      that is not grounds for violating the RHS of some other outer join.
      Noticed while regression-testing new GEQO code, which will blindly follow
      any path that join_is_legal says is legal, and then complain later if that
      leads to a dead end.
      
      I'm not certain that this can result in any visible failure in 8.4: the
      mistake may always be masked by the fact that subsequent attempts to join
      the rest of the RHS of the other join will fail.  But I'm not certain it
      can't, either, and it's definitely not operating as intended.  So back-patch.
      
      The added regression test depends on the new no-failures-allowed logic
      that I'm about to commit in GEQO, so no point back-patching that.
      a43b190e
  10. 18 Jul, 2009 1 commit
    • Tom Lane's avatar
      Fix error cleanup failure caused by 8.4 changes in plpgsql to try to avoid · 011eae60
      Tom Lane authored
      memory leakage in error recovery.  We were calling FreeExprContext, and
      therefore invoking ExprContextCallback callbacks, in both normal and error
      exits from subtransactions.  However this isn't very safe, as shown in
      recent trouble report from Frank van Vugt, in which releasing a tupledesc
      refcount failed.  It's also unnecessary, since the resources that callbacks
      might wish to release should be cleaned up by other error recovery mechanisms
      (ie the resource owners).  We only really want FreeExprContext to release
      memory attached to the exprcontext in the error-exit case.  So, add a bool
      parameter to FreeExprContext to tell it not to call the callbacks.
      
      A more general solution would be to pass the isCommit bool parameter on to
      the callbacks, so they could do only safe things during error exit.  But
      that would make the patch significantly more invasive and possibly break
      third-party code that registers ExprContextCallback callbacks.  We might want
      to do that later in HEAD, but for now I'll just do what seems reasonable to
      back-patch.
      011eae60