1. 29 5月, 2003 2 次提交
    • T
      d998fac9
    • T
      Replace functional-index facility with expressional indexes. Any column · fc8d970c
      Tom Lane 提交于
      of an index can now be a computed expression instead of a simple variable.
      Restrictions on expressions are the same as for predicates (only immutable
      functions, no sub-selects).  This fixes problems recently introduced with
      inlining SQL functions, because the inlining transformation is applied to
      both expression trees so the planner can still match them up.  Along the
      way, improve efficiency of handling index predicates (both predicates and
      index expressions are now cached by the relcache) and fix 7.3 oversight
      that didn't record dependencies of predicate expressions.
      fc8d970c
  2. 28 5月, 2003 1 次提交
  3. 26 5月, 2003 1 次提交
    • T
      Cause CHAR(n) to TEXT or VARCHAR conversion to automatically strip trailing · f45df8c0
      Tom Lane 提交于
      blanks, in hopes of reducing the surprise factor for newbies.  Remove
      redundant operators for VARCHAR (it depends wholly on TEXT operations now).
      Clean up resolution of ambiguous operators/functions to avoid surprising
      choices for domains: domains are treated as equivalent to their base types
      and binary-coercibility is no longer considered a preference item when
      choosing among multiple operators/functions.  IsBinaryCoercible now correctly
      reflects the notion that you need *only* relabel the type to get from type
      A to type B: that is, a domain is binary-coercible to its base type, but
      not vice versa.  Various marginal cleanup, including merging the essentially
      duplicate resolution code in parse_func.c and parse_oper.c.  Improve opr_sanity
      regression test to understand about binary compatibility (using pg_cast),
      and fix a couple of small errors in the catalogs revealed thereby.
      Restructure "special operator" handling to fetch operators via index opclasses
      rather than hardwiring assumptions about names (cleans up the pattern_ops
      stuff a little).
      f45df8c0
  4. 15 5月, 2003 1 次提交
  5. 14 5月, 2003 1 次提交
  6. 12 5月, 2003 1 次提交
    • T
      Apply fixes for problems with dropped columns whose types have also been · d97c9b36
      Tom Lane 提交于
      dropped.  The simplest fix for INSERT/UPDATE cases turns out to be for
      preptlist.c to insert NULLs of a known-good type (I used INT4) rather
      than making them match the deleted column's type.  Since the representation
      of NULL is actually datatype-independent, this should work fine.
      I also re-reverted the patch to disable the use_physical_tlist optimization
      in the presence of dropped columns.  It still doesn't look worth the
      trouble to be smarter, if there are no other bugs to fix.
      Added a regression test to catch future problems in this area.
      d97c9b36
  7. 10 5月, 2003 1 次提交
  8. 09 5月, 2003 2 次提交
  9. 29 4月, 2003 1 次提交
  10. 28 4月, 2003 1 次提交
  11. 25 4月, 2003 1 次提交
    • T
      Infrastructure for upgraded error reporting mechanism. elog.c is · f690920a
      Tom Lane 提交于
      rewritten and the protocol is changed, but most elog calls are still
      elog calls.  Also, we need to contemplate mechanisms for controlling
      all this functionality --- eg, how much stuff should appear in the
      postmaster log?  And what API should libpq expose for it?
      f690920a
  12. 22 4月, 2003 1 次提交
    • T
      Another round of protocol changes. Backend-to-frontend messages now all · 5ed27e35
      Tom Lane 提交于
      have length words.  COPY OUT reimplemented per new protocol: it doesn't
      need \. anymore, thank goodness.  COPY BINARY to/from frontend works,
      at least as far as the backend is concerned --- libpq's PQgetline API
      is not up to snuff, and will have to be replaced with something that is
      null-safe.  libpq uses message length words for performance improvement
      (no cycles wasted rescanning long messages), but not yet for error
      recovery.
      5ed27e35
  13. 18 4月, 2003 1 次提交
  14. 09 4月, 2003 1 次提交
  15. 08 4月, 2003 1 次提交
    • J
      Avoid primary key lookup (and lock) if foreign key does not change · cd203f33
      Jan Wieck 提交于
      on UPDATE.
      
      This get's rid of the long standing annoyance that updating a row
      that has foreign keys locks all the referenced rows even if the
      foreign key values do not change.
      
      The trick is to actually do a check identical to NO ACTION after an
      eventually done UPDATE in the SET DEFAULT case. Since a SET DEFAULT
      operation should have moved referencing rows to a new "home", a following
      NO ACTION check can only fail if the column defaults of the referencing
      table resulted in the key we actually deleted. Thanks to Stephan.
      
      Jan
      cd203f33
  16. 28 3月, 2003 2 次提交
    • 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
    • B
      to_char fixes, Karel Zak · 7a3e7b64
      Bruce Momjian 提交于
      7a3e7b64
  17. 23 3月, 2003 1 次提交
    • T
      Instead of storing pg_statistic stavalues entries as text strings, store · 8d9e025e
      Tom Lane 提交于
      them as arrays of the internal datatype.  This requires treating the
      stavalues columns as 'anyarray' rather than 'text[]', which is not 100%
      kosher but seems to work fine for the purposes we need for pg_statistic.
      Perhaps in the future 'anyarray' will be allowed more generally.
      8d9e025e
  18. 22 3月, 2003 1 次提交
  19. 21 3月, 2003 3 次提交
  20. 20 3月, 2003 4 次提交
    • 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
    • B
      Attached is a patch that limits the range tested by horology to · d7f10705
      Bruce Momjian 提交于
      what is capable using integer-datatime timestamps. It does attempt
      to exercise the maximum allowable timestamp range.
      Also is a small error check when converting a timestamp from external
      to internal format that prevents out of range timestamps from being
      entered.
      
      Files patched:
              Index: src/backend/utils/adt/timestamp.c
                      Added range check to prevent out of range timestamps
                      from being used.
      
              Index: src/test/regress/sql/horology.sql
              Index: src/test/regress/expected/horology-no-DST-before-1970.out
              Index: src/test/regress/expected/horology-solaris-1947.out
                      Limited range of timestamps being checked to
                      Jan 1, 4713 BC  to Dec 31, 294276
      
      In creating this patch, I have seen some definite problems with integer
      timestamps and how they react when used near their limits. For example,
      the following statement gives the correct result:
      
              SELECT timestamp without time zone 'Jan 1, 4713 BC'
                     + interval '109203489 days' AS "Dec 31, 294276";
      
      However, this statement which is the logical inverse of the above
      gives incorrect results:
      
              SELECT timestamp without time zone '12/31/294276'
                   - timestamp without time zone 'Jan 1, 4713 BC' AS "109203489 Days";
      
      John Cochran
      d7f10705
    • B
      This trivial cleans up a little bit of the code in · 3c28f9c1
      Bruce Momjian 提交于
      src/test/regress/regress.c (e.g. removing K & R style parameter
      declarations, improving sprintf() usage, etc.)
      
      Neil Conway
      3c28f9c1
    • B
      Add start time to pg_stat_activity · a1833100
      Bruce Momjian 提交于
      Neil Conway
      a1833100
  21. 16 3月, 2003 1 次提交
  22. 12 3月, 2003 1 次提交
    • T
      Add explicit tests for division by zero to all user-accessible integer · 31e69ccb
      Tom Lane 提交于
      division and modulo functions, to avoid problems on OS X (which fails to
      trap 0 divide at all) and Windows (which traps it in some bizarre
      nonstandard fashion).  Standardize on 'division by zero' as the one true
      spelling of this error message.  Add regression tests as suggested by
      Neil Conway.
      31e69ccb
  23. 06 3月, 2003 1 次提交
  24. 20 2月, 2003 1 次提交
  25. 19 2月, 2003 2 次提交
    • B
      - Modifies LOCKTAG to include a 'classId'. Relation receive a classId of · d0f3a7e9
      Bruce Momjian 提交于
      RelOid_pg_class, and transaction locks XactLockTableId. RelId is renamed
      to objId.
      
      - LockObject() and UnlockObject() functions created, and their use
      sprinkled throughout the code to do descent locking for domains and
      types. They accept lock modes AccessShare and AccessExclusive, as we
      only really need a 'read' and 'write' lock at the moment.  Most locking
      cases are held until the end of the transaction.
      
      This fixes the cases Tom mentioned earlier in regards to locking with
      Domains.  If the patch is good, I'll work on cleaning up issues with
      other database objects that have this problem (most of them).
      
      Rod Taylor
      d0f3a7e9
    • B
      The following patches eliminate the overflows in the j2date() and date2j() · a286f732
      Bruce Momjian 提交于
      functions which limited the maximum date for a timestamp to AD 1465001.
      The new limit is AD 5874897.
      The files affected are:
      
      doc/src/sgml/datatype.sgml:
          Documentation change due to patch. Included is a notice about
          the reduced range when using an eight-byte integer for timestamps.
      
      src/backend/utils/adt/datetime.c:
          Replacement functions for j2date() and date2j() functions.
      
      src/include/utils/datetime.h:
          Corrected a bug with the limit on the earliest possible date,
          Nov 23,-4713 has a Julian day count of -1. The earliest possible
          date should be Nov 24, -4713 with a day count of 0.
      
      src/test/regress/expected/horology-no-DST-before-1970.out:
      src/test/regress/expected/horology-solaris-1947.out:
      src/test/regress/expected/horology.out:
          Copies of expected output for regression testing.
          Note: Only horology.out has been physically tested. I do not have access
          to a Solaris box and I don't know how to provoke the "pre-1970" test.
      
      src/test/regress/sql/horology.sql:
          Added some test cases to check extended range.
      
      John Cochran
      a286f732
  26. 16 2月, 2003 1 次提交
  27. 14 2月, 2003 1 次提交
    • T
      Arrange to give error when a SetOp member statement refers to a variable · 18e8f06c
      Tom Lane 提交于
      of the containing query (which really can only happen in a rule context).
      Per example from Brandon Craig Rhodes.  Also, make the error message
      more specific for the similar case with sub-select in FROM.  The revised
      coding should be easier to adapt to SQL99's LATERAL(), when we get around
      to supporting that.
      18e8f06c
  28. 13 2月, 2003 2 次提交
    • B
      The "random" regression test uses a function called oidrand(), which · 6cb1f4fe
      Bruce Momjian 提交于
      takes two parameters, an OID x and an integer y, and returns "true" with
      probability 1/y (the OID argument is ignored). This can be useful -- for
      example, it can be used to select a random sampling of the rows in a
      table (which is what the "random" regression test uses it for).
      
      This patch removes that function, because it was old and messy. The old
      function had the following problems:
      
      - it was undocumented
      
      - it was poorly named
      
      - it was designed to workaround an optimizer bug that no longer exists
      (the OID argument is to ensure that the optimizer won't optimize away
      calls to the function; AFAIK marking the function as 'volatile' suffices
      nowadays)
      
      - it used a different random-number generation technique than the other
      PSRNG-related functions in the backend do (it called random() like they
      do, but it had its own logic for setting a set and deciding when to
      reseed the RNG).
      
      Ok, this patch removes oidrand(), oidsrand(), and userfntest(), and
      improves the SGML docs a little bit (un-commenting the setseed()
      documentation).
      
      Neil Conway
      6cb1f4fe
    • 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
  29. 11 2月, 2003 1 次提交
  30. 04 2月, 2003 1 次提交