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. 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
  3. 21 3月, 2003 1 次提交
  4. 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
  5. 12 3月, 2003 1 次提交
  6. 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
  7. 16 2月, 2003 1 次提交
  8. 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
  9. 10 2月, 2003 1 次提交
  10. 09 2月, 2003 1 次提交
  11. 24 1月, 2003 1 次提交
  12. 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
  13. 06 1月, 2003 1 次提交
  14. 30 12月, 2002 1 次提交
  15. 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
  16. 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
  17. 06 12月, 2002 3 次提交
  18. 25 11月, 2002 1 次提交
  19. 23 11月, 2002 1 次提交
    • B
      This patch implements FOR EACH STATEMENT triggers, per my email to · 1b7f3cc0
      Bruce Momjian 提交于
      -hackers a couple days ago.
      
      Notes/caveats:
      
              - added regression tests for the new functionality, all
                regression tests pass on my machine
      
              - added pg_dump support
      
              - updated PL/PgSQL to support per-statement triggers; didn't
                look at the other procedural languages.
      
              - there's (even) more code duplication in trigger.c than there
                was previously. Any suggestions on how to refactor the
                ExecXXXTriggers() functions to reuse more code would be
                welcome -- I took a brief look at it, but couldn't see an
                easy way to do it (there are several subtly-different
                versions of the code in question)
      
              - updated the documentation. I also took the liberty of
                removing a big chunk of duplicated syntax documentation in
                the Programmer's Guide on triggers, and moving that
                information to the CREATE TRIGGER reference page.
      
              - I also included some spelling fixes and similar small
                cleanups I noticed while making the changes. If you'd like
                me to split those into a separate patch, let me know.
      
      Neil Conway
      1b7f3cc0
  20. 20 11月, 2002 1 次提交
  21. 15 11月, 2002 2 次提交
    • B
      New version attached. The following is implemented: · 8bc717cb
      Bruce Momjian 提交于
      - CLUSTER ALL clusters all the tables that have some index with
        indisclustered set and the calling user owns.
      - CLUSTER tablename clusters the named table, using the index with
        indisclustered set.  If no index has the bit set, throws elog(ERROR).
      - The multi-relation version (CLUSTER ALL) uses a multitransaction
        approach, similar to what VACUUM does.
      
      Alvaro Herrera
      8bc717cb
    • B
      Add DOMAIN check constraints. · 6b603e67
      Bruce Momjian 提交于
      Rod Taylor
      6b603e67
  22. 13 11月, 2002 1 次提交
  23. 12 11月, 2002 1 次提交
    • T
      Code review for ON COMMIT patch. Make the actual on-commit action happen · f9b5b41e
      Tom Lane 提交于
      before commit, not after :-( --- the original coding is not only unsafe
      if an error occurs while it's processing, but it generates an invalid
      sequence of WAL entries.  Resurrect 7.2 logic for deleting items when
      no longer needed.  Use an enum instead of random macros.  Editorialize
      on names used for routines and constants.  Teach backend/nodes routines
      about new field in CreateTable struct.  Add a regression test.
      f9b5b41e
  24. 10 11月, 2002 1 次提交
  25. 06 11月, 2002 1 次提交
    • T
      First phase of implementing hash-based grouping/aggregation. An AGG plan · f6dba10e
      Tom Lane 提交于
      node now does its own grouping of the input rows, and has no need for a
      preceding GROUP node in the plan pipeline.  This allows elimination of
      the misnamed tuplePerGroup option for GROUP, and actually saves more code
      in nodeGroup.c than it costs in nodeAgg.c, as well as being presumably
      faster.  Restructure the API of query_planner so that we do not commit to
      using a sorted or unsorted plan in query_planner; instead grouping_planner
      makes the decision.  (Right now it isn't any smarter than query_planner
      was, but that will change as soon as it has the option to select a hash-
      based aggregation step.)  Despite all the hackery, no initdb needed since
      only in-memory node types changed.
      f6dba10e
  26. 15 10月, 2002 1 次提交
  27. 23 9月, 2002 1 次提交
  28. 19 9月, 2002 1 次提交
    • T
      Extend pg_cast castimplicit column to a three-way value; this allows us · b26dfb95
      Tom Lane 提交于
      to be flexible about assignment casts without introducing ambiguity in
      operator/function resolution.  Introduce a well-defined promotion hierarchy
      for numeric datatypes (int2->int4->int8->numeric->float4->float8).
      Change make_const to initially label numeric literals as int4, int8, or
      numeric (never float8 anymore).
      Explicitly mark Func and RelabelType nodes to indicate whether they came
      from a function call, explicit cast, or implicit cast; use this to do
      reverse-listing more accurately and without so many heuristics.
      Explicit casts to char, varchar, bit, varbit will truncate or pad without
      raising an error (the pre-7.2 behavior), while assigning to a column without
      any explicit cast will still raise an error for wrong-length data like 7.3.
      This more nearly follows the SQL spec than 7.2 behavior (we should be
      reporting a 'completion condition' in the explicit-cast cases, but we have
      no mechanism for that, so just do silent truncation).
      Fix some problems with enforcement of typmod for array elements;
      it didn't work at all in 'UPDATE ... SET array[n] = foo', for example.
      Provide a generalized array_length_coerce() function to replace the
      specialized per-array-type functions that used to be needed (and were
      missing for NUMERIC as well as all the datetime types).
      Add missing conversions int8<->float4, text<->numeric, oid<->int8.
      initdb forced.
      b26dfb95
  29. 05 9月, 2002 1 次提交
  30. 02 9月, 2002 1 次提交
  31. 01 9月, 2002 1 次提交
    • T
      Code review for domain-constraints patch. Use a new ConstraintTest node · 845a6c3a
      Tom Lane 提交于
      type for runtime constraint checks, instead of misusing the parse-time
      Constraint node for the purpose.  Fix some damage introduced into type
      coercion logic; in particular ensure that a coerced expression tree will
      read out the correct result type when inspected (patch had broken some
      RelabelType cases).  Enforce domain NOT NULL constraints against columns
      that are omitted from an INSERT.
      845a6c3a
  32. 31 8月, 2002 1 次提交
  33. 27 8月, 2002 1 次提交
  34. 19 8月, 2002 2 次提交
  35. 16 8月, 2002 1 次提交
    • B
      Tom Lane wrote: · b1a5f872
      Bruce Momjian 提交于
      > There's no longer a separate call to heap_storage_create in that routine
      > --- the right place to make the test is now in the storage_create
      > boolean parameter being passed to heap_create.  A simple change, but
      > it passeth patch's understanding ...
      
      Thanks.
      
      Attached is a patch against cvs tip as of 8:30 PM PST or so. Turned out
      that even after fixing the failed hunks, there was a new spot in
      bufmgr.c which needed to be fixed (related to temp relations;
      RelationUpdateNumberOfBlocks). But thankfully the regression test code
      caught it :-)
      
      Joe Conway
      b1a5f872
  36. 05 8月, 2002 1 次提交
    • B
      Attached are two patches to implement and document anonymous composite · 9218689b
      Bruce Momjian 提交于
      types for Table Functions, as previously proposed on HACKERS. Here is a
      brief explanation:
      
      1. Creates a new pg_type typtype: 'p' for pseudo type (currently either
           'b' for base or 'c' for catalog, i.e. a class).
      
      2. Creates new builtin type of typtype='p' named RECORD. This is the
           first of potentially several pseudo types.
      
      3. Modify FROM clause grammer to accept:
           SELECT * FROM my_func() AS m(colname1 type1, colname2 type1, ...)
           where m is the table alias, colname1, etc are the column names, and
           type1, etc are the column types.
      
      4. When typtype == 'p' and the function return type is RECORD, a list
           of column defs is required, and when typtype != 'p', it is
      disallowed.
      
      5. A check was added to ensure that the tupdesc provide via the parser
           and the actual return tupdesc match in number and type of
      attributes.
      
      When creating a function you can do:
           CREATE FUNCTION foo(text) RETURNS setof RECORD ...
      
      When using it you can do:
           SELECT * from foo(sqlstmt) AS (f1 int, f2 text, f3 timestamp)
             or
           SELECT * from foo(sqlstmt) AS f(f1 int, f2 text, f3 timestamp)
             or
           SELECT * from foo(sqlstmt) f(f1 int, f2 text, f3 timestamp)
      
      Included in the patches are adjustments to the regression test sql and
      expected files, and documentation.
      
      p.s.
           This potentially solves (or at least improves) the issue of builtin
           Table Functions. They can be bootstrapped as returning RECORD, and
           we can wrap system views around them with properly specified column
           defs. For example:
      
           CREATE VIEW pg_settings AS
             SELECT s.name, s.setting
             FROM show_all_settings()AS s(name text, setting text);
      
           Then we can also add the UPDATE RULE that I previously posted to
           pg_settings, and have pg_settings act like a virtual table, allowing
           settings to be queried and set.
      
      
      Joe Conway
      9218689b