1. 02 5月, 2010 1 次提交
    • T
      Add code to InternalIpcMemoryCreate() to handle the case where shmget() · 5b6a6962
      Tom Lane 提交于
      returns EINVAL for an existing shared memory segment.  Although it's not
      terribly sensible, that behavior does meet the POSIX spec because EINVAL
      is the appropriate error code when the existing segment is smaller than the
      requested size, and the spec explicitly disclaims any particular ordering of
      error checks.  Moreover, it does in fact happen on OS X and probably other
      BSD-derived kernels.  (We were able to talk NetBSD into changing their code,
      but purging that behavior from the wild completely seems unlikely to happen.)
      We need to distinguish collision with a pre-existing segment from invalid size
      request in order to behave sensibly, so it's worth some extra code here to get
      it right.  Per report from Gavin Kistner and subsequent investigation.
      
      Back-patch to all supported versions, since any of them could get used
      with a kernel having the debatable behavior.
      5b6a6962
  2. 01 5月, 2010 1 次提交
    • T
      Fix multiple memory leaks in PLy_spi_execute_fetch_result: it would leak · 80dc8a8f
      Tom Lane 提交于
      memory if the result had zero rows, and also if there was any sort of error
      while converting the result tuples into Python data.  Reported and partially
      fixed by Andres Freund.
      
      Back-patch to all supported versions.  Note: I haven't tested the 7.4 fix.
      7.4's configure check for python is so obsolete it doesn't work on my
      current machines :-(.  The logic change is pretty straightforward though.
      80dc8a8f
  3. 19 4月, 2010 1 次提交
    • R
      Provide better guidance for adjusting shared_buffers. · 750503ce
      Robert Haas 提交于
      This change was previously committed to HEAD, but the consensus seems to be
      in favor of back-patching it.  I'm only backpatching as far as 8.3.X, however,
      because it's not clear to me to what degree this advice applies to older
      branches, and in any case our first advice to anyone attempting to tune those
      versions is likely to be "upgrade".
      750503ce
  4. 16 4月, 2010 3 次提交
  5. 15 4月, 2010 1 次提交
    • T
      Fix a problem introduced by my patch of 2010-01-12 that revised the way · 32616fb1
      Tom Lane 提交于
      relcache reload works.  In the patched code, a relcache entry in process of
      being rebuilt doesn't get unhooked from the relcache hash table; which means
      that if a cache flush occurs due to sinval queue overrun while we're
      rebuilding it, the entry could get blown away by RelationCacheInvalidate,
      resulting in crash or misbehavior.  Fix by ensuring that an entry being
      rebuilt has positive refcount, so it won't be seen as a target for removal
      if a cache flush occurs.  (This will mean that the entry gets rebuilt twice
      in such a scenario, but that's okay.)  It appears that the problem can only
      arise within a transaction that has previously reassigned the relfilenode of
      a pre-existing table, via TRUNCATE or a similar operation.  Per bug #5412
      from Rusty Conover.
      
      Back-patch to 8.2, same as the patch that introduced the problem.
      I think that the failure can't actually occur in 8.2, since it lacks the
      rd_newRelfilenodeSubid optimization, but let's make it work like the later
      branches anyway.
      
      Patch by Heikki, slightly editorialized on by me.
      32616fb1
  6. 09 4月, 2010 2 次提交
  7. 08 4月, 2010 1 次提交
  8. 07 4月, 2010 1 次提交
  9. 04 4月, 2010 1 次提交
  10. 03 4月, 2010 1 次提交
  11. 02 4月, 2010 1 次提交
    • H
      Don't pass an invalid file handle to dup2(). That causes a crash on · 292934de
      Heikki Linnakangas 提交于
      Windows, thanks to a feature in CRT called Parameter Validation.
      
      Backpatch to 8.2, which is the oldest version supported on Windows. In
      8.2 and 8.3 also backpatch the earlier change to use DEVNULL instead of
      NULL_DEV #define for a /dev/null-like device. NULL_DEV was hard-coded to
      "/dev/null" regardless of platform, which didn't work on Windows, while
      DEVNULL works on all platforms. Restarting syslogger didn't work on
      Windows on versions 8.3 and below because of that.
      292934de
  12. 25 3月, 2010 2 次提交
  13. 20 3月, 2010 1 次提交
    • T
      Clear error_context_stack and debug_query_string at the beginning of proc_exit, · e1eb7c81
      Tom Lane 提交于
      so that we won't try to attach any context printouts to messages that get
      emitted while exiting.  Per report from Dennis Koegel, the context functions
      won't necessarily work after we've started shutting down the backend, and it
      seems possible that debug_query_string could be pointing at freed storage
      as well.  The context information doesn't seem particularly relevant to
      such messages anyway, so there's little lost by suppressing it.
      
      Back-patch to all supported branches.  I can only demonstrate a crash with
      log_disconnections messages back to 8.1, but the risk seems real in 8.0 and
      before anyway.
      e1eb7c81
  14. 18 3月, 2010 1 次提交
  15. 12 3月, 2010 1 次提交
  16. 10 3月, 2010 2 次提交
  17. 09 3月, 2010 2 次提交
  18. 08 3月, 2010 4 次提交
  19. 06 3月, 2010 1 次提交
    • T
      When reading pg_hba.conf and similar files, do not treat @file as an inclusion · 0c814238
      Tom Lane 提交于
      unless (1) the @ isn't quoted and (2) the filename isn't empty.  This guards
      against unexpectedly treating usernames or other strings in "flat files"
      as inclusion requests, as seen in a recent trouble report from Ed L.
      The empty-filename case would be guaranteed to misbehave anyway, because our
      subsequent path-munging behavior results in trying to read the directory
      containing the current input file.
      
      I think this might finally explain the report at
      http://archives.postgresql.org/pgsql-bugs/2004-05/msg00132.php
      of a crash after printing "authentication file token too long, skipping",
      since I was able to duplicate that message (though not a crash) on a
      platform where stdio doesn't refuse to read directories.  We never got
      far in investigating that problem, but now I'm suspicious that the trigger
      condition was an @ in the flat password file.
      
      Back-patch to all active branches since the problem can be demonstrated in all
      branches except HEAD.  The test case, creating a user named "@", doesn't cause
      a problem in HEAD since we got rid of the flat password file.  Nonetheless it
      seems like a good idea to not consider quoted @ as a file inclusion spec,
      so I changed HEAD too.
      0c814238
  20. 04 3月, 2010 3 次提交
    • T
      Fix a couple of places that would loop forever if attempts to read a stdio file · 6fe45c96
      Tom Lane 提交于
      set ferror() but never set feof().  This is known to be the case for recent
      glibc when trying to read a directory as a file, and might be true for other
      platforms/cases too.  Per report from Ed L.  (There is more that we ought to
      do about his report, but this is one easily identifiable issue.)
      6fe45c96
    • T
      Make contrib/xml2 use core xml.c's error handler, when available (that is, · e2524c51
      Tom Lane 提交于
      in versions >= 8.3).  The core code is more robust and efficient than what
      was there before, and this also reduces risks involved in swapping different
      libxml error handler settings.
      
      Before 8.3, there is still some risk of problems if add-on modules such as
      Perl invoke libxml without setting their own error handler.  Given the lack
      of reports I'm not sure there's a risk in practice, so I didn't take the
      step of actually duplicating the core code into older contrib/xml2 branches.
      Instead I just tweaked the existing code to ensure it didn't leave a dangling
      pointer to short-lived memory when throwing an error.
      e2524c51
    • T
      Export xml.c's libxml-error-handling support so that contrib/xml2 can use it · f821c16e
      Tom Lane 提交于
      too, instead of duplicating the functionality (badly).
      
      I renamed xml_init to pg_xml_init, because the former seemed just a bit too
      generic to be safe as a global symbol.  I considered likewise renaming
      xml_ereport to pg_xml_ereport, but felt that the reference to ereport probably
      made it sufficiently PG-centric already.
      f821c16e
  21. 03 3月, 2010 4 次提交
  22. 02 3月, 2010 3 次提交
  23. 01 3月, 2010 2 次提交
    • T
      Remove xmlCleanupParser calls from contrib/xml2. · d71936c9
      Tom Lane 提交于
      These are unnecessary and probably dangerous.  I don't see any immediate
      risk situations in the core XML support or contrib/xml2 itself, but there
      could be issues with external uses of libxml2, and in any case it's an
      accident waiting to happen.
      d71936c9
    • T
      Back-patch today's memory management fixups in contrib/xml2. · 4f146ab3
      Tom Lane 提交于
      Prior to 8.3, these changes are not critical for compatibility with core
      Postgres, since core had no libxml2 calls then.  However there is still
      a risk if contrib/xml2 is used along with libxml2 functionality in Perl
      or other loadable modules.  So back-patch to all versions.
      
      Also back-patch addition of regression tests.  I'm not sure how many of
      the cases are interesting without the interaction with core xml code,
      but a silly regression test is still better than none at all.
      4f146ab3