1. 22 9月, 2010 2 次提交
  2. 02 9月, 2010 1 次提交
    • T
      Fix up flushing of composite-type typcache entries to be driven directly by · a15e220a
      Tom Lane 提交于
      SI invalidation events, rather than indirectly through the relcache.
      
      In the previous coding, we had to flush a composite-type typcache entry
      whenever we discarded the corresponding relcache entry.  This caused problems
      at least when testing with RELCACHE_FORCE_RELEASE, as shown in recent report
      from Jeff Davis, and might result in real-world problems given the kind of
      unexpected relcache flush that that test mechanism is intended to model.
      
      The new coding decouples relcache and typcache management, which is a good
      thing anyway from a structural perspective.  The cost is that we have to
      search the typcache linearly to find entries that need to be flushed.  There
      are a couple of ways we could avoid that, but at the moment it's not clear
      it's worth any extra trouble, because the typcache contains very few entries
      in typical operation.
      
      Back-patch to 8.2, the same as some other recent fixes in this general area.
      The patch could be carried back to 8.0 with some additional work, but given
      that it's only hypothetical whether we're fixing any problem observable in
      the field, it doesn't seem worth the work now.
      a15e220a
  3. 30 8月, 2010 1 次提交
    • T
      Reduce PANIC to ERROR in some occasionally-reported btree failure cases. · 83ba488c
      Tom Lane 提交于
      This patch changes _bt_split() and _bt_pagedel() to throw a plain ERROR,
      rather than PANIC, for several cases that are reported from the field
      from time to time:
      * right sibling's left-link doesn't match;
      * PageAddItem failure during _bt_split();
      * parent page's next child isn't right sibling during _bt_pagedel().
      In addition the error messages for these cases have been made a bit
      more verbose, with additional values included.
      
      The original motivation for PANIC here was to capture core dumps for
      subsequent analysis.  But with so many users whose platforms don't capture
      core dumps by default, or who are unprepared to analyze them anyway, it's hard
      to justify a forced database restart when we can fairly easily detect the
      problems before we've reached the critical sections where PANIC would be
      necessary.  It is not currently known whether the reports of these messages
      indicate well-hidden bugs in Postgres, or are a result of storage-level
      malfeasance; the latter possibility suggests that we ought to try to be more
      robust even if there is a bug here that's ultimately found.
      
      Backpatch to 8.2.  The code before that is sufficiently different that
      it doesn't seem worth the trouble to back-port further.
      83ba488c
  4. 29 8月, 2010 1 次提交
  5. 27 8月, 2010 2 次提交
    • T
      Update time zone data files to tzdata release 2010l: DST law changes in · 79beb905
      Tom Lane 提交于
      Egypt and Palestine.  Added new names for two Micronesian timezones:
      Pacific/Chuuk is now preferred over Pacific/Truk (and the preferred
      abbreviation is CHUT not TRUT) and Pacific/Pohnpei is preferred over
      Pacific/Ponape.  Historical corrections for Finland.
      79beb905
    • T
      Fix ExecMakeTableFunctionResult to verify that all rows returned by a SRF · dcfaed3a
      Tom Lane 提交于
      returning "record" actually do have the same rowtype.  This is needed because
      the parser can't realistically enforce that they will all have the same typmod,
      as seen in a recent example from David Wheeler.
      
      Back-patch to 8.0, which is as far back as we have the notion of RECORD
      subtypes being distinguished by typmod.  Wheeler's example depends on
      8.4-and-up features, but I suspect there may be ways to provoke similar
      failures before 8.4.
      dcfaed3a
  6. 26 8月, 2010 1 次提交
  7. 20 8月, 2010 1 次提交
    • T
      Keep exec_simple_check_plan() from thinking "SELECT foo INTO bar" is simple. · 9005604c
      Tom Lane 提交于
      It's not clear if this situation can occur in plpgsql other than via the
      EXECUTE USING case Heikki illustrated, which I will shortly close off.
      However, ignoring the intoClause if it's there is surely wrong, so let's
      patch it for safety.
      
      Backpatch to 8.3, which is as far back as this code has a PlannedStmt
      to deal with.  There might be another way to make an equivalent test
      before that, but since this is just preventing hypothetical bugs,
      I'm not going to obsess about it.
      9005604c
  8. 18 8月, 2010 1 次提交
    • T
      Add missing handling of PlannedStmt.transientPlan in copyfuncs/outfuncs. · 12bc6546
      Tom Lane 提交于
      _outPlannedStmt is only debug support, so the omission there was not very
      serious, but the omission in _copyPlannedStmt is a real bug.  The consequence
      would be that a copied plan tree would never be marked as a transient plan,
      so that we would forget we ought to replan it after some not-yet-ready index
      becomes ready for use.  This might explain some past complaints about indexes
      created with CREATE INDEX CONCURRENTLY not being used right away.  Problem
      spotted by Yeb Havinga.
      
      Back-patch to 8.3, where the field was added.
      12bc6546
  9. 17 8月, 2010 2 次提交
  10. 16 8月, 2010 1 次提交
    • T
      Fix psql's copy of utf2ucs() to match the backend's copy exactly; · 61f78185
      Tom Lane 提交于
      in particular, propagate a fix in the test to see whether a UTF8 character has
      length 4 bytes.  This is likely of little real-world consequence because
      5-or-more-byte UTF8 sequences are not supported by Postgres nor seen anywhere
      in the wild, but still we may as well get it right.  Problem found by Joseph
      Adams.
      
      Bug is aboriginal, so back-patch all the way.
      61f78185
  11. 14 8月, 2010 1 次提交
    • T
      Fix Assert failure in PushOverrideSearchPath when trying to restore a search · c358483c
      Tom Lane 提交于
      path that specifies useTemp, but there is no active temp schema in the
      current session.  (This can happen if the path was saved during a transaction
      that created a temp schema and was later rolled back.)  For existing callers
      it's sufficient to ignore the useTemp flag in this case, though we might
      later want to offer an option to create a fresh temp schema.  So far as I can
      tell this is just an Assert failure: in a non-assert build, the code would
      push a zero onto the new search path, which is useless but not very harmful.
      Per bug report from Heikki.
      
      Back-patch to 8.3; prior versions don't have this code.
      c358483c
  12. 12 8月, 2010 2 次提交
  13. 10 8月, 2010 1 次提交
    • T
      Fix incorrect logic in plpgsql for cleanup after evaluation of non-simple · c895b59e
      Tom Lane 提交于
      expressions.  We need to deal with this when handling subscripts in an array
      assignment, and also when catching an exception.  In an Assert-enabled build
      these omissions led to Assert failures, but I think in a normal build the
      only consequence would be short-term memory leakage; which may explain why
      this wasn't reported from the field long ago.
      
      Back-patch to all supported versions.  7.4 doesn't have exceptions, but
      otherwise these bugs go all the way back.
      
      Heikki Linnakangas and Tom Lane
      c895b59e
  14. 07 8月, 2010 1 次提交
  15. 03 8月, 2010 1 次提交
    • T
      Fix core dump in QTNodeCompare when tsquery_cmp() is applied to two empty · 8c378335
      Tom Lane 提交于
      tsqueries.  CompareTSQ has to have a guard for the case rather than blindly
      applying QTNodeCompare to random data past the end of the datums.  Also,
      change QTNodeCompare to be a little less trusting: use an actual test rather
      than just Assert'ing that the input is sane.  Problem encountered while
      investigating another issue (I saw a core dump in autoanalyze on a table
      containing multiple empty tsquery values).
      
      Back-patch to all branches with tsquery support.
      
      In HEAD, also fix some bizarre (though not outright wrong) coding in
      tsq_mcontains().
      8c378335
  16. 31 7月, 2010 1 次提交
    • T
      Improved version of patch to protect pg_get_expr() against misuse: · 9e6dc137
      Tom Lane 提交于
      look through join alias Vars to avoid breaking join queries, and
      move the test to someplace where it will catch more possible ways
      of calling a function.  We still ought to throw away the whole thing
      in favor of a data-type-based solution, but that's not feasible in
      the back branches.
      
      Completion of back-port of my patch of yesterday.
      9e6dc137
  17. 30 7月, 2010 2 次提交
    • T
      Fix another longstanding problem in copy_relation_data: it was blithely · 242dc381
      Tom Lane 提交于
      assuming that a local char[] array would be aligned on at least a word
      boundary.  There are architectures on which that is pretty much guaranteed to
      NOT be the case ... and those arches also don't like non-aligned memory
      accesses, meaning that log_newpage() would crash if it ever got invoked.
      Even on Intel-ish machines there's a potential for a large performance penalty
      from doing I/O to an inadequately aligned buffer.  So palloc it instead.
      
      Backpatch to 8.0 --- 7.4 doesn't have this code.
      242dc381
    • R
      Fix possible page corruption by ALTER TABLE .. SET TABLESPACE. · 0378e4e7
      Robert Haas 提交于
      If a zeroed page is present in the heap, ALTER TABLE .. SET TABLESPACE will
      set the LSN and TLI while copying it, which is wrong, and heap_xlog_newpage()
      will do the same thing during replay, so the corruption propagates to any
      standby.  Note, however, that the bug can't be demonstrated unless archiving
      is enabled, since in that case we skip WAL logging altogether, and the LSN/TLI
      are not set.
      
      Back-patch to 8.0; prior releases do not have tablespaces.
      
      Analysis and patch by Jeff Davis.  Adjustments for back-branches and minor
      wordsmithing by me.
      0378e4e7
  18. 28 7月, 2010 2 次提交
    • T
      Fix potential failure when hashing the output of a subplan that produces · 581fe933
      Tom Lane 提交于
      a pass-by-reference datatype with a nontrivial projection step.
      We were using the same memory context for the projection operation as for
      the temporary context used by the hashtable routines in execGrouping.c.
      However, the hashtable routines feel free to reset their temp context at
      any time, which'd lead to destroying input data that was still needed.
      Report and diagnosis by Tao Ma.
      
      Back-patch to 8.1, where the problem was introduced by the changes that
      allowed us to work with "virtual" tuples instead of materializing intermediate
      tuple values everywhere.  The earlier code looks quite similar, but it doesn't
      suffer the problem because the data gets copied into another context as a
      result of having to materialize ExecProject's output tuple.
      581fe933
    • P
      Spelling fix · 3c93b54b
      Peter Eisentraut 提交于
      3c93b54b
  19. 27 7月, 2010 1 次提交
  20. 23 7月, 2010 1 次提交
  21. 13 7月, 2010 1 次提交
  22. 10 7月, 2010 1 次提交
    • T
      Avoid an Assert failure in deconstruct_array() by making get_attstatsslot() · 8c21b4e9
      Tom Lane 提交于
      use the actual element type of the array it's disassembling, rather than
      trusting the type OID passed in by its caller.  This is needed because
      sometimes the planner passes in a type OID that's only binary-compatible
      with the target column's type, rather than being an exact match.  Per an
      example from Bernd Helmle.
      
      Possibly we should refactor get_attstatsslot/free_attstatsslot to not expect
      the caller to supply type ID data at all, but for now I'll just do the
      minimum-change fix.
      
      Back-patch to 7.4.  Bernd's test case only crashes back to 8.0, but since
      these subroutines are the same in 7.4, I suspect there may be variant
      cases that would crash 7.4 as well.
      8c21b4e9
  23. 08 7月, 2010 1 次提交
    • T
      Fix "cannot handle unplanned sub-select" error that can occur when a · 67ba60ef
      Tom Lane 提交于
      sub-select contains a join alias reference that expands into an expression
      containing another sub-select.  Per yesterday's report from Merlin Moncure
      and subsequent off-list investigation.
      
      Back-patch to 7.4.  Older versions didn't attempt to flatten sub-selects in
      ways that would trigger this problem.
      67ba60ef
  24. 05 7月, 2010 1 次提交
    • H
      The previous fix in CVS HEAD and 8.4 for handling the case where a cursor · 82345970
      Heikki Linnakangas 提交于
      being used in a PL/pgSQL FOR loop is closed was inadequate, as Tom Lane
      pointed out. The bug affects FOR statement variants too, because you can
      close an implicitly created cursor too by guessing the "<unnamed portal X>"
      name created for it.
      
      To fix that, "pin" the portal to prevent it from being dropped while it's
      being used in a PL/pgSQL FOR loop. Backpatch all the way to 7.4 which is
      the oldest supported version.
      82345970
  25. 03 7月, 2010 2 次提交
  26. 01 7月, 2010 2 次提交
  27. 22 6月, 2010 1 次提交
    • R
      Deprecate the use of => as an operator name. · 8ce3f26f
      Robert Haas 提交于
      In HEAD, emit a warning when an operator named => is defined.
      In both HEAD and the backbranches (except in 8.2, where contrib
      modules do not have documentation), document that hstore's text =>
      text operator may be removed in a future release, and encourage the
      use of the hstore(text, text) function instead.  This function only
      exists in HEAD (previously, it was called tconvert), so backpatch
      it back to 8.2, when hstore was added.  Per discussion.
      8ce3f26f
  28. 16 6月, 2010 2 次提交
    • T
      Fix dblink_build_sql_insert() and related functions to handle dropped · 9d4ec3c3
      Tom Lane 提交于
      columns correctly.  In passing, get rid of some dead logic in the
      underlying get_sql_insert() etc functions --- there is no caller that
      will pass null value-arrays to them.
      
      Per bug report from Robert Voinea.
      9d4ec3c3
    • T
      Consolidate and improve checking of key-column-attnum arguments for · 93ad2591
      Tom Lane 提交于
      dblink_build_sql_insert() and related functions.  In particular, be sure to
      reject references to dropped and out-of-range column numbers.  The numbers
      are still interpreted as physical column numbers, though, for backward
      compatibility.
      
      This patch replaces Joe's patch of 2010-02-03, which handled only some aspects
      of the problem.
      93ad2591
  29. 15 6月, 2010 1 次提交
    • T
      Rearrange dblink's dblink_build_sql_insert() and related routines to open and · fa66d0e2
      Tom Lane 提交于
      lock the target relation just once per SQL function call.  The original coding
      obtained and released lock several times per call.  Aside from saving a
      not-insignificant number of cycles, this eliminates possible race conditions
      if someone tries to modify the relation's schema concurrently.  Also
      centralize locking and permission-checking logic.
      
      Problem noted while investigating a trouble report from Robert Voinea --- his
      problem is still to be fixed, though.
      fa66d0e2
  30. 09 6月, 2010 2 次提交