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. 30 4月, 2003 1 次提交
    • T
      Infrastructure for deducing Param types from context, in the same way · aa282d44
      Tom Lane 提交于
      that the types of untyped string-literal constants are deduced (ie,
      when coerce_type is applied to 'em, that's what the type must be).
      Remove the ancient hack of storing the input Param-types array as a
      global variable, and put the info into ParseState instead.  This touches
      a lot of files because of adjustment of routine parameter lists, but
      it's really not a large patch.  Note: PREPARE statement still insists on
      exact specification of parameter types, but that could easily be relaxed
      now, if we wanted to do so.
      aa282d44
  3. 29 4月, 2003 1 次提交
  4. 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
  5. 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
  6. 14 2月, 2003 2 次提交
  7. 11 2月, 2003 1 次提交
    • T
      Use a varno not chosen at random for dummy variables in the top-level · 9069a5fc
      Tom Lane 提交于
      targetlist of a set-operation tree.  I'm not sure that this solution
      will really stand the test of time --- perhaps we need to make a special
      RTE for such vars to refer to.  But this quick hack fixes Brandon Craig
      Rhodes' complaint of 10-Feb-02 about EXCEPT in CREATE RULE, while not
      changing any behavior in the better-tested cases where leftmostRTI is
      one anyway.
      9069a5fc
  8. 09 2月, 2003 1 次提交
  9. 17 1月, 2003 1 次提交
    • T
      Fix parse_agg.c to detect ungrouped Vars in sub-SELECTs; remove code · b19adc1a
      Tom Lane 提交于
      that used to do it in planner.  That was an ancient kluge that was
      never satisfactory; errors should be detected at parse time when possible.
      But at the time we didn't have the support mechanism (expression_tree_walker
      et al) to make it convenient to do in the parser.
      b19adc1a
  10. 03 1月, 2003 1 次提交
    • T
      Enforces NOT NULL constraints to be applied against new PRIMARY KEY · 0a02d47a
      Tom Lane 提交于
      columns in DefineIndex.  So, ALTER TABLE ... PRIMARY KEY will now
      automatically add the NOT NULL constraint.  It appeared the alter_table
      regression test wanted this to occur, as after the change the regression
      test better matched in inline 'fails'/'succeeds' comments.
      
      Rod Taylor
      0a02d47a
  11. 17 12月, 2002 1 次提交
  12. 14 12月, 2002 1 次提交
  13. 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
  14. 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
  15. 15 11月, 2002 1 次提交
  16. 22 10月, 2002 1 次提交
  17. 20 10月, 2002 1 次提交
  18. 15 10月, 2002 1 次提交
  19. 22 9月, 2002 1 次提交
    • T
      Move most of the error checking for foreign-key constraints out of · ac355d55
      Tom Lane 提交于
      parse analysis and into the execution code (in tablecmds.c).  This
      eliminates a lot of unreasonably complex code that needed to have two
      or more execution paths in case it was dealing with a not-yet-created
      table column vs. an already-existing one.  The execution code is always
      dealing with already-created tables and so needs only one case.  This
      also eliminates some potential race conditions (the table wasn't locked
      between parse analysis and execution), makes it easy to fix the gripe
      about wrong referenced-column names generating a misleading error message,
      and lets us easily add a dependency from the foreign-key constraint to
      the unique index that it requires the referenced table to have.  (Cf.
      complaint from Kris Jurka 12-Sep-2002 on pgsql-bugs.)
      
      Also, third try at building a deletion mechanism that is not sensitive
      to the order in which pg_depend entries are visited.  Adding the above-
      mentioned dependency exposed the folly of what dependency.c had been
      doing: it failed for cases where B depends on C while both auto-depend
      on A.  Dropping A should succeed in this case, but was failing if C
      happened to be visited before B.  It appears the only solution is two
      separate walks over the dependency tree.
      ac355d55
  20. 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
  21. 05 9月, 2002 1 次提交
  22. 02 9月, 2002 1 次提交
    • B
      I checked all the previous string handling errors and most of them were · a12b4e27
      Bruce Momjian 提交于
      already fixed by You. However there were a few left and attached patch
      should fix the rest of them.
      
      I used StringInfo only in 2 places and both of them are inside debug
      ifdefs. Only performance penalty will come from using strlen() like all
      the other code does.
      
      I also modified some of the already patched parts by changing
      snprintf(buf, 2 * BUFSIZE, ... style lines to
      snprintf(buf, sizeof(buf), ... where buf is an array.
      
      Jukka Holappa
      a12b4e27
  23. 29 8月, 2002 2 次提交
  24. 27 8月, 2002 2 次提交
  25. 20 8月, 2002 1 次提交
  26. 19 8月, 2002 1 次提交
    • T
      Remove Ident nodetype in favor of using String nodes; this fixes some · 6ebc90b0
      Tom Lane 提交于
      latent wrong-struct-type bugs and makes the coding style more uniform,
      since the majority of places working with lists of column names were
      already using Strings not Idents.  While at it, remove vestigial
      support for Stream node type, and otherwise-unreferenced nodes.h entries
      for T_TupleCount and T_BaseNode.
      NB: full recompile is recommended due to changes of Node type numbers.
      This shouldn't force an initdb though.
      6ebc90b0
  27. 03 8月, 2002 1 次提交
    • T
      ALTER TABLE DROP COLUMN works. Patch by Christopher Kings-Lynne, · 38bb77a5
      Tom Lane 提交于
      code review by Tom Lane.  Remaining issues: functions that take or
      return tuple types are likely to break if one drops (or adds!)
      a column in the table defining the type.  Need to think about what
      to do here.
      
      Along the way: some code review for recent COPY changes; mark system
      columns attnotnull = true where appropriate, per discussion a month ago.
      38bb77a5
  28. 17 7月, 2002 1 次提交
  29. 13 7月, 2002 1 次提交
    • T
      Second phase of committing Rod Taylor's pg_depend/pg_constraint patch. · 7c6df91d
      Tom Lane 提交于
      pg_relcheck is gone; CHECK, UNIQUE, PRIMARY KEY, and FOREIGN KEY
      constraints all have real live entries in pg_constraint.  pg_depend
      exists, and RESTRICT/CASCADE options work on most kinds of DROP;
      however, pg_depend is not yet very well populated with dependencies.
      (Most of the ones that are present at this point just replace formerly
      hardwired associations, such as the implicit drop of a relation's pg_type
      entry when the relation is dropped.)  Need to add more logic to create
      dependency entries, improve pg_dump to dump constraints in place of
      indexes and triggers, and add some regression tests.
      7c6df91d
  30. 21 6月, 2002 1 次提交
  31. 13 6月, 2002 1 次提交
    • T
      Repair for bug #691 --- CREATE TABLE AS column aliases fail to be · 59c325bb
      Tom Lane 提交于
      applied when the select is a UNION (or other set-operation).
      
      An alternative route to a fix would be to leave analyze.c alone and
      change plan_set_operations in prepunion.c to take column names from
      the topmost targetlist.  But I am not sure that would work in all
      cases.  This patch seems the minimum-risk fix.
      59c325bb
  32. 29 5月, 2002 1 次提交
  33. 13 5月, 2002 1 次提交
  34. 29 4月, 2002 1 次提交
    • T
      Second try at fixing join alias variables. Instead of attaching miscellaneous · 6c598869
      Tom Lane 提交于
      lists to join RTEs, attach a list of Vars and COALESCE expressions that will
      replace the join's alias variables during planning.  This simplifies
      flatten_join_alias_vars while still making it easy to fix up varno references
      when transforming the query tree.  Add regression test cases for interactions
      of subqueries with outer joins.
      6c598869
  35. 24 4月, 2002 1 次提交
    • B
      Reports missing values as bad. · dd4ca824
      Bruce Momjian 提交于
      BAD:  INSERT INTO tab (col1, col2) VALUES ('val1');
      GOOD: INSERT INTO tab (col1, col2) VALUES ('val1', 'val2');
      
      Regress tests against DEFAULT and normal values as they're managed
      slightly different.
      
      Rod Taylor
      dd4ca824
  36. 18 4月, 2002 1 次提交
    • T
      Opclasses live in namespaces. I also took the opportunity to create · 27a54ae2
      Tom Lane 提交于
      an 'opclass owner' column in pg_opclass.  Nothing is done with it at
      present, but since there are plans to invent a CREATE OPERATOR CLASS
      command soon, we'll probably want DROP OPERATOR CLASS too, which
      suggests that a notion of ownership would be a good idea.
      27a54ae2
  37. 17 4月, 2002 1 次提交
    • T
      Operators live in namespaces. CREATE/DROP/COMMENT ON OPERATOR take · 6cef5d25
      Tom Lane 提交于
      qualified operator names directly, for example CREATE OPERATOR myschema.+
      ( ... ).  To qualify an operator name in an expression you need to write
      OPERATOR(myschema.+) (thanks to Peter for suggesting an escape hatch).
      I also took advantage of having to reformat pg_operator to fix something
      that'd been bugging me for a while: mergejoinable operators should have
      explicit links to the associated cross-data-type comparison operators,
      rather than hardwiring an assumption that they are named < and >.
      6cef5d25