1. 03 5月, 2003 1 次提交
    • T
      Portal and memory management infrastructure for extended query protocol. · de28dc9a
      Tom Lane 提交于
      Both plannable queries and utility commands are now always executed
      within Portals, which have been revamped so that they can handle the
      load (they used to be good only for single SELECT queries).  Restructure
      code to push command-completion-tag selection logic out of postgres.c,
      so that it won't have to be duplicated between simple and extended queries.
      initdb forced due to addition of a field to Query nodes.
      de28dc9a
  2. 09 4月, 2003 1 次提交
  3. 28 3月, 2003 1 次提交
    • B
      This patch implements holdable cursors, following the proposal · 54f7338f
      Bruce Momjian 提交于
      (materialization into a tuple store) discussed on pgsql-hackers earlier.
      I've updated the documentation and the regression tests.
      
      Notes on the implementation:
      
      - I needed to change the tuple store API slightly -- it assumes that it
      won't be used to hold data across transaction boundaries, so the temp
      files that it uses for on-disk storage are automatically reclaimed at
      end-of-transaction. I added a flag to tuplestore_begin_heap() to control
      this behavior. Is changing the tuple store API in this fashion OK?
      
      - in order to store executor results in a tuple store, I added a new
      CommandDest. This works well for the most part, with one exception: the
      current DestFunction API doesn't provide enough information to allow the
      Executor to store results into an arbitrary tuple store (where the
      particular tuple store to use is chosen by the call site of
      ExecutorRun). To workaround this, I've temporarily hacked up a solution
      that works, but is not ideal: since the receiveTuple DestFunction is
      passed the portal name, we can use that to lookup the Portal data
      structure for the cursor and then use that to get at the tuple store the
      Portal is using. This unnecessarily ties the Portal code with the
      tupleReceiver code, but it works...
      
      The proper fix for this is probably to change the DestFunction API --
      Tom suggested passing the full QueryDesc to the receiveTuple function.
      In that case, callers of ExecutorRun could "subclass" QueryDesc to add
      any additional fields that their particular CommandDest needed to get
      access to. This approach would work, but I'd like to think about it for
      a little bit longer before deciding which route to go. In the mean time,
      the code works fine, so I don't think a fix is urgent.
      
      - (semi-related) I added a NO SCROLL keyword to DECLARE CURSOR, and
      adjusted the behavior of SCROLL in accordance with the discussion on
      -hackers.
      
      - (unrelated) Cleaned up some SGML markup in sql.sgml, copy.sgml
      
      Neil Conway
      54f7338f
  4. 21 3月, 2003 1 次提交
  5. 20 3月, 2003 1 次提交
    • B
      Todo items: · 5f65225f
      Bruce Momjian 提交于
      Add ALTER SEQUENCE to modify min/max/increment/cache/cycle values
      
      Also updated create sequence docs to mention NO MINVALUE, & NO MAXVALUE.
      
      New Files:
      doc/src/sgml/ref/alter_sequence.sgml
      src/test/regress/expected/sequence.out
      src/test/regress/sql/sequence.sql
      
      
      ALTER SEQUENCE is NOT transactional.  It behaves similarly to setval().
      It matches the proposed SQL200N spec, as well as Oracle in most ways --
      Oracle lacks RESTART WITH for some strange reason.
      
      --
      Rod Taylor <rbt@rbt.ca>
      5f65225f
  6. 12 3月, 2003 1 次提交
  7. 10 3月, 2003 1 次提交
    • T
      Restructure parsetree representation of DECLARE CURSOR: now it's a · aa83bc04
      Tom Lane 提交于
      utility statement (DeclareCursorStmt) with a SELECT query dangling from
      it, rather than a SELECT query with a few unusual fields in it.  Add
      code to determine whether a planned query can safely be run backwards.
      If DECLARE CURSOR specifies SCROLL, ensure that the plan can be run
      backwards by adding a Materialize plan node if it can't.  Without SCROLL,
      you get an error if you try to fetch backwards from a cursor that can't
      handle it.  (There is still some discussion about what the exact
      behavior should be, but this is necessary infrastructure in any case.)
      Along the way, make EXPLAIN DECLARE CURSOR work.
      aa83bc04
  8. 09 3月, 2003 1 次提交
    • T
      Revise tuplestore and nodeMaterial so that we don't have to read the · aa60eecc
      Tom Lane 提交于
      entire contents of the subplan into the tuplestore before we can return
      any tuples.  Instead, the tuplestore holds what we've already read, and
      we fetch additional rows from the subplan as needed.  Random access to
      the previously-read rows works with the tuplestore, and doesn't affect
      the state of the partially-read subplan.  This is a step towards fixing
      the problems with cursors over complex queries --- we don't want to
      stick in Materialize nodes if they'll prevent quick startup for a cursor.
      aa60eecc
  9. 16 2月, 2003 1 次提交
  10. 13 2月, 2003 1 次提交
    • B
      Code for WITHOUT OIDS. · 8195f8f0
      Bruce Momjian 提交于
      
      On Wed, 2003-01-08 at 21:59, Christopher Kings-Lynne wrote:
      > I agree.  I want to remove OIDs from heaps of our tables when we go to 7.3.
      > I'd rather not have to do it in the dump due to down time.
      
      
      Rod Taylor <rbt@rbt.ca>
      8195f8f0
  11. 10 2月, 2003 1 次提交
  12. 09 2月, 2003 3 次提交
  13. 04 2月, 2003 1 次提交
  14. 03 2月, 2003 1 次提交
    • T
      Tweak planner and executor to avoid doing ExecProject() in table scan · 4cff59d8
      Tom Lane 提交于
      nodes where it's not really necessary.  In many cases where the scan node
      is not the topmost plan node (eg, joins, aggregation), it's possible to
      just return the table tuple directly instead of generating an intermediate
      projection tuple.  In preliminary testing, this reduced the CPU time
      needed for 'SELECT COUNT(*) FROM foo' by about 10%.
      4cff59d8
  15. 28 1月, 2003 1 次提交
    • T
      Upgrade cost estimation for joins, per discussion with Bradley Baetz. · 70fba704
      Tom Lane 提交于
      Try to model the effect of rescanning input tuples in mergejoins;
      account for JOIN_IN short-circuiting where appropriate.  Also, recognize
      that mergejoin and hashjoin clauses may now be more than single operator
      calls, so we have to charge appropriate execution costs.
      70fba704
  16. 24 1月, 2003 2 次提交
    • T
      Modify planner's implied-equality-deduction code so that when a set · f5e83662
      Tom Lane 提交于
      of known-equal expressions includes any constant expressions (including
      Params from outer queries), we actively suppress any 'var = var'
      clauses that are or could be deduced from the set, generating only the
      deducible 'var = const' clauses instead.  The idea here is to push down
      the restrictions implied by the equality set to base relations whenever
      possible.  Once we have applied the 'var = const' clauses, the 'var = var'
      clauses are redundant, and should be suppressed both to save work at
      execution and to avoid double-counting restrictivity.
      f5e83662
    • P
      Grant options, and cascading revoke. Grant options are allowed only for · ef742251
      Peter Eisentraut 提交于
      users right now, not groups.  Extension of has_foo_privileges functions to
      query the grant options.  Extension of aclitem type to store grantor.
      ef742251
  17. 23 1月, 2003 1 次提交
  18. 21 1月, 2003 1 次提交
    • T
      IN clauses appearing at top level of WHERE can now be handled as joins. · bdfbfde1
      Tom Lane 提交于
      There are two implementation techniques: the executor understands a new
      JOIN_IN jointype, which emits at most one matching row per left-hand row,
      or the result of the IN's sub-select can be fed through a DISTINCT filter
      and then joined as an ordinary relation.
      Along the way, some minor code cleanup in the optimizer; notably, break
      out most of the jointree-rearrangement preprocessing in planner.c and
      put it in a new file prep/prepjointree.c.
      bdfbfde1
  19. 16 1月, 2003 1 次提交
    • T
      Allow merge and hash joins to occur on arbitrary expressions (anything not · de97072e
      Tom Lane 提交于
      containing a volatile function), rather than only on 'Var = Var' clauses
      as before.  This makes it practical to do flatten_join_alias_vars at the
      start of planning, which in turn eliminates a bunch of klugery inside the
      planner to deal with alias vars.  As a free side effect, we now detect
      implied equality of non-Var expressions; for example in
      	SELECT ... WHERE a.x = b.y and b.y = 42
      we will deduce a.x = 42 and use that as a restriction qual on a.  Also,
      we can remove the restriction introduced 12/5/02 to prevent pullup of
      subqueries whose targetlists contain sublinks.
      Still TODO: make statistical estimation routines in selfuncs.c and costsize.c
      smarter about expressions that are more complex than plain Vars.  The need
      for this is considerably greater now that we have to be able to estimate
      the suitability of merge and hash join techniques on such expressions.
      de97072e
  20. 13 1月, 2003 1 次提交
  21. 12 1月, 2003 1 次提交
  22. 11 1月, 2003 2 次提交
  23. 10 1月, 2003 1 次提交
    • T
      Adjust parser so that 'x NOT IN (subselect)' is converted to · 6bc61fc0
      Tom Lane 提交于
      'NOT (x IN (subselect))', that is 'NOT (x = ANY (subselect))',
      rather than 'x <> ALL (subselect)' as we formerly did.  This
      opens the door to optimizing NOT IN the same way as IN, whereas
      there's no hope of optimizing the expression using <>.  Also,
      convert 'x <> ALL (subselect)' to the NOT(IN) style, so that
      the optimization will be available when processing rules dumped
      by older Postgres versions.
      initdb forced due to small change in SubLink node representation.
      6bc61fc0
  24. 06 1月, 2003 1 次提交
  25. 30 12月, 2002 1 次提交
  26. 18 12月, 2002 1 次提交
  27. 17 12月, 2002 1 次提交
    • T
      Code review for palloc0 patch --- avoid dangerous and unnecessary · 88177f77
      Tom Lane 提交于
      practice of evaluating MemSet's arguments multiple times, except for
      the special case of newNode(), where we can assume the argument is
      a constant sizeof() operator.
      Also, add GetMemoryChunkContext() to mcxt.c's API, in preparation for
      fixing recent GEQO breakage.
      88177f77
  28. 16 12月, 2002 2 次提交
    • T
      Tweak default memory context allocation policy so that a context is not · e64c7feb
      Tom Lane 提交于
      given any malloc block until something is first allocated in it; but
      thereafter, MemoryContextReset won't release that first malloc block.
      This preserves the quick-reset property of the original policy, without
      forcing 8K to be allocated to every context whether any of it is ever
      used or not.  Also, remove some more no-longer-needed explicit freeing
      during ExecEndPlan.
      e64c7feb
    • T
      Revise executor APIs so that all per-query state structure is built in · 5bab36e9
      Tom Lane 提交于
      a per-query memory context created by CreateExecutorState --- and destroyed
      by FreeExecutorState.  This provides a final solution to the longstanding
      problem of memory leaked by various ExecEndNode calls.
      5bab36e9
  29. 14 12月, 2002 2 次提交
    • T
      Clean up plantree representation of SubPlan-s --- SubLink does not appear · 2d8d6662
      Tom Lane 提交于
      in the planned representation of a subplan at all any more, only SubPlan.
      This means subselect.c doesn't scribble on its input anymore, which seems
      like a good thing; and there are no longer three different possible
      interpretations of a SubLink.  Simplify node naming and improve comments
      in primnodes.h.  No change to stored rules, though.
      2d8d6662
    • T
      Phase 3 of read-only-plans project: ExecInitExpr now builds expression · 3a4f7dde
      Tom Lane 提交于
      execution state trees, and ExecEvalExpr takes an expression state tree
      not an expression plan tree.  The plan tree is now read-only as far as
      the executor is concerned.  Next step is to begin actually exploiting
      this property.
      3a4f7dde
  30. 13 12月, 2002 1 次提交
    • T
      Preliminary code review for domain CHECK constraints patch: add documentation, · b0422b21
      Tom Lane 提交于
      make VALUE a non-reserved word again, use less invasive method of passing
      ConstraintTestValue into transformExpr, fix problems with nested constraint
      testing, do correct thing with NULL result from a constraint expression,
      remove memory leak.  Domain checks still need much more work if we are going
      to allow ALTER DOMAIN, however.
      b0422b21
  31. 12 12月, 2002 1 次提交
    • T
      Phase 2 of read-only-plans project: restructure expression-tree nodes · a0bf885f
      Tom Lane 提交于
      so that all executable expression nodes inherit from a common supertype
      Expr.  This is somewhat of an exercise in code purity rather than any
      real functional advance, but getting rid of the extra Oper or Func node
      formerly used in each operator or function call should provide at least
      a little space and speed improvement.
      initdb forced by changes in stored-rules representation.
      a0bf885f
  32. 06 12月, 2002 3 次提交