1. 20 10月, 2010 1 次提交
    • T
      Fix incorrect generation of whole-row variables in planner. · 6e74a91b
      Tom Lane 提交于
      A couple of places in the planner need to generate whole-row Vars, and were
      cutting corners by setting vartype = RECORDOID in the Vars, even in cases
      where there's an identifiable named composite type for the RTE being
      referenced.  While we mostly got away with this, it failed when there was
      also a parser-generated whole-row reference to the same RTE, because the
      two Vars weren't equal() due to the difference in vartype.  Fix by
      providing a subroutine the planner can call to generate whole-row Vars
      the same way the parser does.
      
      Per bug #5716 from Andrew Tipton.  Back-patch to 9.0 where one of the bogus
      calls was introduced (the other one is new in HEAD).
      6e74a91b
  2. 11 10月, 2010 1 次提交
    • T
      Support triggers on views. · 2ec993a7
      Tom Lane 提交于
      This patch adds the SQL-standard concept of an INSTEAD OF trigger, which
      is fired instead of performing a physical insert/update/delete.  The
      trigger function is passed the entire old and/or new rows of the view,
      and must figure out what to do to the underlying tables to implement
      the update.  So this feature can be used to implement updatable views
      using trigger programming style rather than rule hacking.
      
      In passing, this patch corrects the names of some columns in the
      information_schema.triggers view.  It seems the SQL committee renamed
      them somewhere between SQL:99 and SQL:2003.
      
      Dean Rasheed, reviewed by Bernd Helmle; some additional hacking by me.
      2ec993a7
  3. 21 9月, 2010 1 次提交
  4. 26 2月, 2010 1 次提交
  5. 03 1月, 2010 1 次提交
  6. 26 10月, 2009 1 次提交
    • T
      Re-implement EvalPlanQual processing to improve its performance and eliminate · 9f2ee8f2
      Tom Lane 提交于
      a lot of strange behaviors that occurred in join cases.  We now identify the
      "current" row for every joined relation in UPDATE, DELETE, and SELECT FOR
      UPDATE/SHARE queries.  If an EvalPlanQual recheck is necessary, we jam the
      appropriate row into each scan node in the rechecking plan, forcing it to emit
      only that one row.  The former behavior could rescan the whole of each joined
      relation for each recheck, which was terrible for performance, and what's much
      worse could result in duplicated output tuples.
      
      Also, the original implementation of EvalPlanQual could not re-use the recheck
      execution tree --- it had to go through a full executor init and shutdown for
      every row to be tested.  To avoid this overhead, I've associated a special
      runtime Param with each LockRows or ModifyTable plan node, and arranged to
      make every scan node below such a node depend on that Param.  Thus, by
      signaling a change in that Param, the EPQ machinery can just rescan the
      already-built test plan.
      
      This patch also adds a prohibition on set-returning functions in the
      targetlist of SELECT FOR UPDATE/SHARE.  This is needed to avoid the
      duplicate-output-tuple problem.  It seems fairly reasonable since the
      other restrictions on SELECT FOR UPDATE are meant to ensure that there
      is a unique correspondence between source tuples and result tuples,
      which an output SRF destroys as much as anything else does.
      9f2ee8f2
  7. 13 10月, 2009 1 次提交
    • T
      Move the handling of SELECT FOR UPDATE locking and rechecking out of · 0adaf4cb
      Tom Lane 提交于
      execMain.c and into a new plan node type LockRows.  Like the recent change
      to put table updating into a ModifyTable plan node, this increases planning
      flexibility by allowing the operations to occur below the top level of the
      plan tree.  It's necessary in any case to restore the previous behavior of
      having FOR UPDATE locking occur before ModifyTable does.
      
      This partially refactors EvalPlanQual to allow multiple rows-under-test
      to be inserted into the EPQ machinery before starting an EPQ test query.
      That isn't sufficient to fix EPQ's general bogosity in the face of plans
      that return multiple rows per test row, though.  Since this patch is
      mostly about getting some plan node infrastructure in place and not about
      fixing ten-year-old bugs, I will leave EPQ improvements for another day.
      
      Another behavioral change that we could now think about is doing FOR UPDATE
      before LIMIT, but that too seems like it should be treated as a followon
      patch.
      0adaf4cb
  8. 20 4月, 2009 1 次提交
    • T
      Fix estimate_num_groups() to not fail on PlaceHolderVars, per report from · 1d97c19a
      Tom Lane 提交于
      Stefan Kaltenbrunner.  The most reasonable behavior (at least for the near
      term) seems to be to ignore the PlaceHolderVar and examine its argument
      instead.  In support of this, change the API of pull_var_clause() to allow
      callers to request recursion into PlaceHolderVars.  Currently
      estimate_num_groups() is the only customer for that behavior, but where
      there's one there may be others.
      1d97c19a
  9. 02 1月, 2009 1 次提交
  10. 16 11月, 2008 1 次提交
    • T
      Make SELECT FOR UPDATE/SHARE work on inheritance trees, by having the plan · 0656ed3d
      Tom Lane 提交于
      return the tableoid as well as the ctid for any FOR UPDATE targets that
      have child tables.  All child tables are listed in the ExecRowMark list,
      but the executor just skips the ones that didn't produce the current row.
      
      Curiously, this longstanding restriction doesn't seem to have been documented
      anywhere; so no doc changes.
      0656ed3d
  11. 02 11月, 2008 1 次提交
    • T
      Remove all uses of the deprecated functions heap_formtuple, heap_modifytuple, · 902d1cb3
      Tom Lane 提交于
      and heap_deformtuple in favor of the newer functions heap_form_tuple et al
      (which do the same things but use bool control flags instead of arbitrary
      char values).  Eliminate the former duplicate coding of these functions,
      reducing the deprecated functions to mere wrappers around the newer ones.
      We can't get rid of them entirely because add-on modules probably still
      contain many instances of the old coding style.
      
      Kris Jurka
      902d1cb3
  12. 22 10月, 2008 1 次提交
    • T
      Add a concept of "placeholder" variables to the planner. These are variables · e6ae3b5d
      Tom Lane 提交于
      that represent some expression that we desire to compute below the top level
      of the plan, and then let that value "bubble up" as though it were a plain
      Var (ie, a column value).
      
      The immediate application is to allow sub-selects to be flattened even when
      they are below an outer join and have non-nullable output expressions.
      Formerly we couldn't flatten because such an expression wouldn't properly
      go to NULL when evaluated above the outer join.  Now, we wrap it in a
      PlaceHolderVar and arrange for the actual evaluation to occur below the outer
      join.  When the resulting Var bubbles up through the join, it will be set to
      NULL if necessary, yielding the correct results.  This fixes a planner
      limitation that's existed since 7.1.
      
      In future we might want to use this mechanism to re-introduce some form of
      Hellerstein's "expensive functions" optimization, ie place the evaluation of
      an expensive function at the most suitable point in the plan tree.
      e6ae3b5d
  13. 29 8月, 2008 1 次提交
    • T
      Extend the parser location infrastructure to include a location field in · a2794623
      Tom Lane 提交于
      most node types used in expression trees (both before and after parse
      analysis).  This allows us to place an error cursor in many situations
      where we formerly could not, because the information wasn't available
      beyond the very first level of parse analysis.  There's a fair amount
      of work still to be done to persuade individual ereport() calls to actually
      include an error location, but this gets the initdb-forcing part of the
      work out of the way; and the situation is already markedly better than
      before for complaints about unimplementable implicit casts, such as
      CASE and UNION constructs with incompatible alternative data types.
      Per my proposal of a few days ago.
      a2794623
  14. 19 6月, 2008 1 次提交
  15. 12 5月, 2008 1 次提交
    • A
      Restructure some header files a bit, in particular heapam.h, by removing some · f8c4d7db
      Alvaro Herrera 提交于
      unnecessary #include lines in it.  Also, move some tuple routine prototypes and
      macros to htup.h, which allows removal of heapam.h inclusion from some .c
      files.
      
      For this to work, a new header file access/sysattr.h needed to be created,
      initially containing attribute numbers of system columns, for pg_dump usage.
      
      While at it, make contrib ltree, intarray and hstore header files more
      consistent with our header style.
      f8c4d7db
  16. 02 1月, 2008 1 次提交
  17. 17 3月, 2007 1 次提交
    • T
      Fix up the remaining places where the expression node structure would lose · 0f4ff460
      Tom Lane 提交于
      available information about the typmod of an expression; namely, Const,
      ArrayRef, ArrayExpr, and EXPR and ARRAY SubLinks.  In the ArrayExpr and
      SubLink cases it wasn't really the data structure's fault, but exprTypmod()
      being lazy.  This seems like a good idea in view of the expected increase in
      typmod usage from Teodor's work to allow user-defined types to have typmods.
      In particular this responds to the concerns we had about eliminating the
      special-purpose hack that exprTypmod() used to have for BPCHAR Consts.
      We can now tell whether or not such a Const has been cast to a specific
      length, and report or display properly if so.
      
      initdb forced due to changes in stored rules.
      0f4ff460
  18. 19 2月, 2007 1 次提交
    • T
      Get rid of some old and crufty global variables in the planner. When · 7c5e5439
      Tom Lane 提交于
      this code was last gone over, there wasn't really any alternative to
      globals because we didn't have the PlannerInfo struct being passed all
      through the planner code.  Now that we do, we can restructure things
      to avoid non-reentrancy.  I'm fooling with this because otherwise I'd
      have had to add another global variable for the planned compact
      range table list.
      7c5e5439
  19. 06 1月, 2007 1 次提交
  20. 04 10月, 2006 1 次提交
  21. 12 8月, 2006 1 次提交
  22. 01 5月, 2006 1 次提交
  23. 06 4月, 2006 1 次提交
    • T
      Fix a bunch of problems with domains by making them use special input functions · 7fdb4305
      Tom Lane 提交于
      that apply the necessary domain constraint checks immediately.  This fixes
      cases where domain constraints went unchecked for statement parameters,
      PL function local variables and results, etc.  We can also eliminate existing
      special cases for domains in places that had gotten it right, eg COPY.
      
      Also, allow domains over domains (base of a domain is another domain type).
      This almost worked before, but was disallowed because the original patch
      hadn't gotten it quite right.
      7fdb4305
  24. 05 3月, 2006 1 次提交
  25. 23 11月, 2005 1 次提交
  26. 15 10月, 2005 1 次提交
  27. 06 6月, 2005 1 次提交
    • T
      Remove planner's private fields from Query struct, and put them into · 9ab4d981
      Tom Lane 提交于
      a new PlannerInfo struct, which is passed around instead of the bare
      Query in all the planning code.  This commit is essentially just a
      code-beautification exercise, but it does open the door to making
      larger changes to the planner data structures without having to muck
      with the widely-known Query struct.
      9ab4d981
  28. 23 5月, 2005 1 次提交
  29. 29 4月, 2005 1 次提交
    • T
      Implement sharable row-level locks, and use them for foreign key references · bedb78d3
      Tom Lane 提交于
      to eliminate unnecessary deadlocks.  This commit adds SELECT ... FOR SHARE
      paralleling SELECT ... FOR UPDATE.  The implementation uses a new SLRU
      data structure (managed much like pg_subtrans) to represent multiple-
      transaction-ID sets.  When more than one transaction is holding a shared
      lock on a particular row, we create a MultiXactId representing that set
      of transactions and store its ID in the row's XMAX.  This scheme allows
      an effectively unlimited number of row locks, just as we did before,
      while not costing any extra overhead except when a shared lock actually
      has to be shared.   Still TODO: use the regular lock manager to control
      the grant order when multiple backends are waiting for a row lock.
      
      Alvaro Herrera and Tom Lane.
      bedb78d3
  30. 07 4月, 2005 1 次提交
    • T
      Merge Resdom nodes into TargetEntry nodes to simplify code and save a · ad161bcc
      Tom Lane 提交于
      few palloc's.  I also chose to eliminate the restype and restypmod fields
      entirely, since they are redundant with information stored in the node's
      contained expression; re-examining the expression at need seems simpler
      and more reliable than trying to keep restype/restypmod up to date.
      
      initdb forced due to change in contents of stored rules.
      ad161bcc
  31. 18 3月, 2005 1 次提交
  32. 01 1月, 2005 1 次提交
    • P
      · 2ff50159
      PostgreSQL Daemon 提交于
      Tag appropriate files for rc3
      
      Also performed an initial run through of upgrading our Copyright date to
      extend to 2005 ... first run here was very simple ... change everything
      where: grep 1996-2004 && the word 'Copyright' ... scanned through the
      generated list with 'less' first, and after, to make sure that I only
      picked up the right entries ...
      2ff50159
  33. 07 11月, 2004 1 次提交
  34. 29 8月, 2004 1 次提交
  35. 16 6月, 2004 1 次提交
    • T
      Represent type-specific length coercion functions as pg_cast entries, · d70a42e6
      Tom Lane 提交于
      eliminating the former hard-wired convention about their names.  Allow
      pg_cast entries to represent both type coercion and length coercion in
      a single step --- this is represented by a function that takes an
      extra typmod argument, just like a length coercion function.  This
      nicely merges the type and length coercion mechanisms into something
      at least a little cleaner than we had before.  Make use of the single-
      coercion-step behavior to fix integer-to-bit coercion so that coercing
      to bit(n) yields the rightmost n bits of the integer instead of the
      leftmost n bits.  This should fix recurrent complaints about the odd
      behavior of this coercion.  Clean up the documentation of the bit string
      functions, and try to put it where people might actually find it.
      Also, get rid of the unreliable heuristics in ruleutils.c about whether
      to display nested coercion steps; instead require parse_coerce.c to
      label them properly in the first place.
      d70a42e6
  36. 31 5月, 2004 1 次提交
  37. 26 5月, 2004 1 次提交
    • N
      Reimplement the linked list data structure used throughout the backend. · d0b4399d
      Neil Conway 提交于
      In the past, we used a 'Lispy' linked list implementation: a "list" was
      merely a pointer to the head node of the list. The problem with that
      design is that it makes lappend() and length() linear time. This patch
      fixes that problem (and others) by maintaining a count of the list
      length and a pointer to the tail node along with each head node pointer.
      A "list" is now a pointer to a structure containing some meta-data
      about the list; the head and tail pointers in that structure refer
      to ListCell structures that maintain the actual linked list of nodes.
      
      The function names of the list API have also been changed to, I hope,
      be more logically consistent. By default, the old function names are
      still available; they will be disabled-by-default once the rest of
      the tree has been updated to use the new API names.
      d0b4399d
  38. 30 11月, 2003 1 次提交
    • P
      · 969685ad
      PostgreSQL Daemon 提交于
      $Header: -> $PostgreSQL Changes ...
      969685ad
  39. 12 8月, 2003 1 次提交
  40. 04 8月, 2003 1 次提交