1. 19 Apr, 2003 3 commits
  2. 04 Apr, 2003 1 commit
  3. 27 Mar, 2003 1 commit
    • Bruce Momjian's avatar
      This patch implements holdable cursors, following the proposal · 54f7338f
      Bruce Momjian authored
      (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. 03 Feb, 2003 1 commit
  5. 10 Jan, 2003 1 commit
  6. 15 Dec, 2002 1 commit
  7. 13 Dec, 2002 1 commit
  8. 12 Dec, 2002 1 commit
    • Tom Lane's avatar
      Phase 2 of read-only-plans project: restructure expression-tree nodes · a0bf885f
      Tom Lane authored
      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
  9. 01 Dec, 2002 1 commit
    • Tom Lane's avatar
      Run COPY OUT in a temporary memory context that's reset once per row, · 3a18f01b
      Tom Lane authored
      and eliminate its manual pfree() calls.  This solves the encoding-conversion
      bug recently reported, and should be faster and more robust than the
      original coding anyway.  For example, we are no longer at risk if
      datatype output routines leak memory or choose to return a constant string.
      3a18f01b
  10. 26 Nov, 2002 1 commit
  11. 25 Nov, 2002 1 commit
  12. 23 Nov, 2002 1 commit
    • Bruce Momjian's avatar
      This patch implements FOR EACH STATEMENT triggers, per my email to · 1b7f3cc0
      Bruce Momjian authored
      -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
  13. 13 Nov, 2002 1 commit
  14. 11 Nov, 2002 1 commit
  15. 10 Nov, 2002 1 commit
  16. 19 Oct, 2002 1 commit
  17. 14 Oct, 2002 1 commit
    • Tom Lane's avatar
      Arrange to copy relcache's trigdesc structure at the start of any · 8f2a289d
      Tom Lane authored
      query that uses it.  This ensures that triggers will be applied consistently
      throughout a query even if someone commits changes to the relation's
      pg_class.reltriggers field meanwhile.  Per crash report from Laurette Cisneros.
      While at it, simplify memory management in relcache.c, which no longer
      needs the old hack to try to keep trigger info in the same place over
      a relcache entry rebuild.  (Should try to fix rd_att and rewrite-rule
      access similarly, someday.)  And make RelationBuildTriggers simpler and
      more robust by making it build the trigdesc in working memory and then
      CopyTriggerDesc() into cache memory.
      8f2a289d
  18. 20 Sep, 2002 4 commits
  19. 04 Sep, 2002 1 commit
  20. 02 Sep, 2002 1 commit
    • Tom Lane's avatar
      Code review for HeapTupleHeader changes. Add version number to page headers · c7a165ad
      Tom Lane authored
      (overlaying low byte of page size) and add HEAP_HASOID bit to t_infomask,
      per earlier discussion.  Simplify scheme for overlaying fields in tuple
      header (no need for cmax to live in more than one place).  Don't try to
      clear infomask status bits in tqual.c --- not safe to do it there.  Don't
      try to force output table of a SELECT INTO to have OIDs, either.  Get rid
      of unnecessarily complex three-state scheme for TupleDesc.tdhasoids, which
      has already caused one recent failure.  Improve documentation.
      c7a165ad
  21. 29 Aug, 2002 2 commits
  22. 24 Aug, 2002 1 commit
    • Tom Lane's avatar
      The cstring datatype can now be copied, passed around, etc. The typlen · 976246cc
      Tom Lane authored
      value '-2' is used to indicate a variable-width type whose width is
      computed as strlen(datum)+1.  Everything that looks at typlen is updated
      except for array support, which Joe Conway is working on; at the moment
      it wouldn't work to try to create an array of cstring.
      976246cc
  23. 22 Aug, 2002 1 commit
  24. 19 Aug, 2002 2 commits
  25. 15 Aug, 2002 1 commit
    • Bruce Momjian's avatar
      Tom Lane wrote: · b1a5f872
      Bruce Momjian authored
      > 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
  26. 02 Aug, 2002 1 commit
    • Tom Lane's avatar
      ALTER TABLE DROP COLUMN works. Patch by Christopher Kings-Lynne, · 38bb77a5
      Tom Lane authored
      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
  27. 30 Jul, 2002 1 commit
    • Bruce Momjian's avatar
      IMPROVED VERSION APPLIED: · 874148fe
      Bruce Momjian authored
      The attached patch completes the following TODO item:
      
          * Generate failure on short COPY lines rather than pad NULLs
      
      I also restructed a lot of the existing COPY code, did some code
      review on the column list patch sent in by Brent Verner a little
      while ago, and added some regression tests. I also added an
      explicit check (and resultant error) for extra data before
      the end-of-line.
      
      Neil Conway
      874148fe
  28. 20 Jul, 2002 1 commit
    • Bruce Momjian's avatar
      oid is needed, it is added at the end of the struct (after the null · b0f5086e
      Bruce Momjian authored
      bitmap, if present).
      
      Per Tom Lane's suggestion the information whether a tuple has an oid
      or not is carried in the tuple descriptor.  For debugging reasons
      tdhasoid is of type char, not bool.  There are predefined values for
      WITHOID, WITHOUTOID and UNDEFOID.
      
      This patch has been generated against a cvs snapshot from last week
      and I don't expect it to apply cleanly to current sources.  While I
      post it here for public review, I'm working on a new version against a
      current snapshot.  (There's been heavy activity recently; hope to
      catch up some day ...)
      
      This is a long patch;  if it is too hard to swallow, I can provide it
      in smaller pieces:
      
      Part 1:  Accessor macros
      Part 2:  tdhasoid in TupDesc
      Part 3:  Regression test
      Part 4:  Parameter withoid to heap_addheader
      Part 5:  Eliminate t_oid from HeapTupleHeader
      
      Part 2 is the most hairy part because of changes in the executor and
      even in the parser;  the other parts are straightforward.
      
      Up to part 4 the patched postmaster stays binary compatible to
      databases created with an unpatched version.  Part 5 is small (100
      lines) and finally breaks compatibility.
      
      Manfred Koizar
      b0f5086e
  29. 18 Jul, 2002 1 commit
    • Bruce Momjian's avatar
      The attached patch (against HEAD) implements · a90db34b
      Bruce Momjian authored
        COPY x (a,d,c,b) from stdin;
        COPY x (a,c) to stdout;
      
      as well as the corresponding changes to pg_dump to use the new
      functionality.  This functionality is not available when using
      the BINARY option.  If a column is not specified in the COPY FROM
      statement, its default values will be used.
      
      In addition to this functionality, I tweaked a couple of the
      error messages emitted by the new COPY <options> checks.
      
      Brent Verner
      a90db34b
  30. 20 Jun, 2002 2 commits
  31. 21 May, 2002 2 commits
    • Tom Lane's avatar
      Since COPY fires triggers, it seems like a good idea for it to use · 6c6f395a
      Tom Lane authored
      a frozen (copied) snapshot too.  Move execMain's snapshot copying code
      out into a subroutine in case we find other places that need it.
      6c6f395a
    • Tom Lane's avatar
      Remove global variable scanCommandId in favor of storing a command ID · 959e61e9
      Tom Lane authored
      in snapshots, per my proposal of a few days ago.  Also, tweak heapam.c
      routines (heap_insert, heap_update, heap_delete, heap_mark4update) to
      be passed the command ID to use, instead of doing GetCurrentCommandID.
      For catalog updates they'll still get passed current command ID, but
      for updates generated from the main executor they'll get passed the
      command ID saved in the snapshot the query is using.  This should fix
      some corner cases associated with functions and triggers that advance
      current command ID while an outer query is still in progress.
      959e61e9