1. 24 1月, 2008 2 次提交
  2. 21 1月, 2008 1 次提交
  3. 18 1月, 2008 2 次提交
  4. 16 1月, 2008 1 次提交
    • T
      Revise memory management for libxml calls. Instead of keeping libxml's data · ac12412e
      Tom Lane 提交于
      in whichever context happens to be current during a call of an xml.c function,
      use a dedicated context that will not go away until we explicitly delete it
      (which we do at transaction end or subtransaction abort).  This makes recovery
      after an error much simpler --- we don't have to individually delete the data
      structures created by libxml.  Also, we need to initialize and cleanup libxml
      only once per transaction (if there's no error) instead of once per function
      call, so it should be a bit faster.  We'll need to keep an eye out for
      intra-transaction memory leaks, though.  Alvaro and Tom.
      ac12412e
  5. 14 1月, 2008 1 次提交
    • T
      Fix CREATE INDEX CONCURRENTLY so that it won't use synchronized scan for · d3b1b1f9
      Tom Lane 提交于
      its second pass over the table.  It has to start at block zero, else the
      "merge join" logic for detecting which TIDs are already in the index
      doesn't work.  Hence, extend heapam.c's API so that callers can enable or
      disable syncscan.  (I put in an option to disable buffer access strategy,
      too, just in case somebody needs it.)  Per report from Hannes Dorbath.
      d3b1b1f9
  6. 12 1月, 2008 1 次提交
  7. 11 1月, 2008 1 次提交
    • T
      Fix a conceptual error in my patch of 2007-10-26 that avoided considering · 59fc64ac
      Tom Lane 提交于
      clauseless joins of relations that have unexploited join clauses.  Rather
      than looking at every other base relation in the query, the correct thing is
      to examine the other relations in the "initial_rels" list of the current
      make_rel_from_joinlist() invocation, because those are what we actually have
      the ability to join against.  This might be a subset of the whole query in
      cases where join_collapse_limit or from_collapse_limit or full joins have
      prevented merging the whole query into a single join problem.  This is a bit
      untidy because we have to pass those rels down through a new PlannerInfo
      field, but it's necessary.  Per bug #3865 from Oleg Kharin.
      59fc64ac
  8. 10 1月, 2008 2 次提交
    • T
      Fix CREATE INDEX CONCURRENTLY to not deadlock against an automatic or manual · ceb93600
      Tom Lane 提交于
      VACUUM that is blocked waiting to get lock on the table being indexed.
      Per report and fix suggestion from Greg Stark.
      ceb93600
    • T
      Fix some planner issues found while investigating Kevin Grittner's report · 6a652252
      Tom Lane 提交于
      of poorer planning in 8.3 than 8.2:
      
      1. After pushing a constant across an outer join --- ie, given
      "a LEFT JOIN b ON (a.x = b.y) WHERE a.x = 42", we can deduce that b.y is
      sort of equal to 42, in the sense that we needn't fetch any b rows where
      it isn't 42 --- loop to see if any additional deductions can be made.
      Previous releases did that by recursing, but I had mistakenly thought that
      this was no longer necessary given the EquivalenceClass machinery.
      
      2. Allow pushing constants across outer join conditions even if the
      condition is outerjoin_delayed due to a lower outer join.  This is safe
      as long as the condition is strict and we re-test it at the upper join.
      
      3. Keep the outer-join clause even if we successfully push a constant
      across it.  This is *necessary* in the outerjoin_delayed case, but
      even in the simple case, it seems better to do this to ensure that the
      join search order heuristics will consider the join as reasonable to
      make.  Mark such a clause as having selectivity 1.0, though, since it's
      not going to eliminate very many rows after application of the constant
      condition.
      
      4. Tweak have_relevant_eclass_joinclause to report that two relations
      are joinable when they have vars that are equated to the same constant.
      We won't actually generate any joinclause from such an EquivalenceClass,
      but again it seems that in such a case it's a good idea to consider
      the join as worth costing out.
      
      5. Fix a bug in select_mergejoin_clauses that was exposed by these
      changes: we have to reject candidate mergejoin clauses if either side was
      equated to a constant, because we can't construct a canonical pathkey list
      for such a clause.  This is an implementation restriction that might be
      worth fixing someday, but it doesn't seem critical to get it done for 8.3.
      6a652252
  9. 09 1月, 2008 2 次提交
  10. 04 1月, 2008 3 次提交
    • T
      Stamp release 8.3RC1. · 2bf121e4
      Tom Lane 提交于
      Security: CVE-2007-4769, CVE-2007-4772, CVE-2007-6067, CVE-2007-6600, CVE-2007-6601
      2bf121e4
    • T
      Make standard maintenance operations (including VACUUM, ANALYZE, REINDEX, · eedb068c
      Tom Lane 提交于
      and CLUSTER) execute as the table owner rather than the calling user, using
      the same privilege-switching mechanism already used for SECURITY DEFINER
      functions.  The purpose of this change is to ensure that user-defined
      functions used in index definitions cannot acquire the privileges of a
      superuser account that is performing routine maintenance.  While a function
      used in an index is supposed to be IMMUTABLE and thus not able to do anything
      very interesting, there are several easy ways around that restriction; and
      even if we could plug them all, there would remain a risk of reading sensitive
      information and broadcasting it through a covert channel such as CPU usage.
      
      To prevent bypassing this security measure, execution of SET SESSION
      AUTHORIZATION and SET ROLE is now forbidden within a SECURITY DEFINER context.
      
      Thanks to Itagaki Takahiro for reporting this vulnerability.
      
      Security: CVE-2007-6600
      eedb068c
    • T
      Fix assorted security-grade bugs in the regex engine. All of these problems · 98f27aae
      Tom Lane 提交于
      are shared with Tcl, since it's their code to begin with, and the patches
      have been copied from Tcl 8.5.0.  Problems:
      
      CVE-2007-4769: Inadequate check on the range of backref numbers allows
      crash due to out-of-bounds read.
      CVE-2007-4772: Infinite loop in regex optimizer for pattern '($|^)*'.
      CVE-2007-6067: Very slow optimizer cleanup for regex with a large NFA
      representation, as well as crash if we encounter an out-of-memory condition
      during NFA construction.
      
      Part of the response to CVE-2007-6067 is to put a limit on the number of
      states in the NFA representation of a regex.  This seems needed even though
      the within-the-code problems have been corrected, since otherwise the code
      could try to use very large amounts of memory for a suitably-crafted regex,
      leading to potential DOS by driving the system into swap, activating a kernel
      OOM killer, etc.
      
      Although there are certainly plenty of ways to drive the system into effective
      DOS with poorly-written SQL queries, these problems seem worth treating as
      security issues because many applications might accept regex search patterns
      from untrustworthy sources.
      
      Thanks to Will Drewry of Google for reporting these problems.  Patches by Will
      Drewry and Tom Lane.
      
      Security: CVE-2007-4769, CVE-2007-4772, CVE-2007-6067
      98f27aae
  11. 03 1月, 2008 1 次提交
    • T
      Forbid ALTER TABLE and CLUSTER when there are pending AFTER-trigger events · 20e86215
      Tom Lane 提交于
      in the current backend for the target table.  These operations move tuples
      around and would thus invalidate the TIDs stored in the trigger event records.
      (We need not worry about events in other backends, since acquiring exclusive
      lock should be enough to ensure there aren't any.)  It might be sufficient
      to forbid only the table-rewriting variants of ALTER TABLE, but in the absence
      of any compelling use-case, let's just be safe and simple.  Per follow-on
      investigation of bug #3847, though this is not actually the same problem
      reported therein.
      
      Possibly this should be back-patched, but since the case has never been
      reported from the field, I didn't bother.
      20e86215
  12. 02 1月, 2008 3 次提交
  13. 28 12月, 2007 1 次提交
    • T
      Improve consistency of error reporting in GUC assign_hook routines. Some · 5233dc15
      Tom Lane 提交于
      were reporting ERROR for interactive assignments and LOG for other cases,
      some were saying nothing for non-interactive cases, and a few did yet other
      things.  Make them use a new function GUC_complaint_elevel() to establish
      a reasonably uniform policy about how to report.  There are still a few
      edge cases such as assign_search_path(), but it's much better than before.
      Per gripe from Devrim Gunduz and subsequent discussion.
      
      As noted by Alvaro, it'd be better to fold these custom messages into the
      standard "invalid parameter value" complaint from guc.c, perhaps as the DETAIL
      field.  However that will require more redesign than seems prudent for 8.3.
      This is a relatively safe, low-impact change that we can afford to risk now.
      5233dc15
  14. 11 12月, 2007 1 次提交
  15. 09 12月, 2007 1 次提交
    • T
      Fix mergejoin cost estimation so that we consider the statistical ranges of · 9fd88436
      Tom Lane 提交于
      the two join variables at both ends: not only trailing rows that need not be
      scanned because there cannot be a match on the other side, but initial rows
      that will be scanned without possibly having a match.  This allows a more
      realistic estimate of startup cost to be made, per recent pgsql-performance
      discussion.  In passing, fix a couple of bugs that had crept into
      mergejoinscansel: it was not quite up to speed for the task of estimating
      descending-order scans, which is a new requirement in 8.3.
      9fd88436
  16. 03 12月, 2007 1 次提交
  17. 02 12月, 2007 1 次提交
    • T
      Code review for LIKE ... INCLUDING INDEXES patch. Fix failure to propagate · 265f904d
      Tom Lane 提交于
      constraint status of copied indexes (bug #3774), as well as various other
      small bugs such as failure to pstrdup when needed.  Allow INCLUDING INDEXES
      indexes to be merged with identical declared indexes (perhaps not real useful,
      but the code is there and having it not apply to LIKE indexes seems pretty
      unorthogonal).  Avoid useless work in generateClonedIndexStmt().  Undo some
      poorly chosen API changes, and put a couple of routines in modules that seem
      to be better places for them.
      265f904d
  18. 01 12月, 2007 1 次提交
    • T
      Avoid incrementing the CommandCounter when CommandCounterIncrement is called · 895a94de
      Tom Lane 提交于
      but no database changes have been made since the last CommandCounterIncrement.
      This should result in a significant improvement in the number of "commands"
      that can typically be performed within a transaction before hitting the 2^32
      CommandId size limit.  In particular this buys back (and more) the possible
      adverse consequences of my previous patch to fix plan caching behavior.
      
      The implementation requires tracking whether the current CommandCounter
      value has been "used" to mark any tuples.  CommandCounter values stored into
      snapshots are presumed not to be used for this purpose.  This requires some
      small executor changes, since the executor used to conflate the curcid of
      the snapshot it was using with the command ID to mark output tuples with.
      Separating these concepts allows some small simplifications in executor APIs.
      
      Something for the TODO list: look into having CommandCounterIncrement not do
      AcceptInvalidationMessages.  It seems fairly bogus to be doing it there,
      but exactly where to do it instead isn't clear, and I'm disinclined to mess
      with asynchronous behavior during late beta.
      895a94de
  19. 29 11月, 2007 2 次提交
    • T
      Adjust the names of a couple of tsearch index support functions that had · 11fccbea
      Tom Lane 提交于
      inappropriately generic-sounding names.  This is more or less free since
      we already forced initdb for the next beta, and it may prevent confusion or
      name conflicts (particularly at the C-global-symbol level) down the road.
      Per my proposal yesterday.
      11fccbea
    • T
      Install a lookaside cache to speed up repeated lookups of the same operator · d54ca567
      Tom Lane 提交于
      by short-circuiting schema search path and ambiguous-operator resolution
      computations.  Remarkably, this buys as much as 45% speedup of repetitive
      simple queries that involve operators that are not an exact match to the
      input datatypes.  It should be marginally faster even for exact-match
      cases, though I've not had success in proving an improvement in benchmark
      tests.  Per report from Guillame Smet and subsequent discussion.
      d54ca567
  20. 28 11月, 2007 1 次提交
  21. 27 11月, 2007 1 次提交
  22. 24 11月, 2007 2 次提交
  23. 23 11月, 2007 1 次提交
  24. 22 11月, 2007 1 次提交
  25. 17 11月, 2007 2 次提交
    • T
      GIN index build's allocatedMemory counter needs to be long, not uint32. · 16dcd5e5
      Tom Lane 提交于
      Else, in a 64-bit machine with maintenance_work_mem set to above 4Gb,
      the counter overflows and we never recognize having reached the
      maintenance_work_mem limit.  I believe this explains out-of-memory
      failure recently reported by Sean Davis.
      
      This is a bug, so backpatch to 8.2.
      16dcd5e5
    • T
      Repair still another bug in the btree page split WAL reduction patch: · 93190c30
      Tom Lane 提交于
      it failed for splits of non-leaf pages because in such pages the first
      data key on a page is suppressed, and so we can't just copy the first
      key from the right page to reconstitute the left page's high key.
      Problem found by Koichi Suzuki, patch by Heikki.
      93190c30
  26. 16 11月, 2007 4 次提交