Skip to content
Snippets Groups Projects
  1. Oct 02, 2012
    • Tom Lane's avatar
      Work around unportable behavior of malloc(0) and realloc(NULL, 0). · 09ac603c
      Tom Lane authored
      On some platforms these functions return NULL, rather than the more common
      practice of returning a pointer to a zero-sized block of memory.  Hack our
      various wrapper functions to hide the difference by substituting a size
      request of 1.  This is probably not so important for the callers, who
      should never touch the block anyway if they asked for size 0 --- but it's
      important for the wrapper functions themselves, which mistakenly treated
      the NULL result as an out-of-memory failure.  This broke at least pg_dump
      for the case of no user-defined aggregates, as per report from
      Matthew Carrington.
      
      Back-patch to 9.2 to fix the pg_dump issue.  Given the lack of previous
      complaints, it seems likely that there is no live bug in previous releases,
      even though some of these functions were in place before that.
      09ac603c
    • Tom Lane's avatar
      Standardize naming of malloc/realloc/strdup wrapper functions. · a563d941
      Tom Lane authored
      We had a number of variants on the theme of "malloc or die", with the
      majority named like "pg_malloc", but by no means all.  Standardize on the
      names pg_malloc, pg_malloc0, pg_realloc, pg_strdup.  Get rid of pg_calloc
      entirely in favor of using pg_malloc0.
      
      This is an essentially cosmetic change, so no back-patch.  (I did find
      a couple of places where psql and pg_dump were using plain malloc or
      strdup instead of the pg_ versions, but they don't look significant
      enough to bother back-patching.)
      a563d941
    • Bruce Momjian's avatar
      In pg_upgrade, improve error reporting when the number of relation · 8a759809
      Bruce Momjian authored
      objects does not match between the old and new clusters.
      
      Backpatch to 9.2.
      8a759809
    • Bruce Momjian's avatar
      Adjust pg_upgrade query so toast tables related to system catalog schema · ac96b851
      Bruce Momjian authored
      entries are not dumped.   This fixes an error caused by
      droping/recreating the information_schema, but other failures were also
      possible.
      
      Backpatch to 9.2.
      ac96b851
    • Bruce Momjian's avatar
      In pg_upgrade, try to convert the locale names to canonical form before · b61837a4
      Bruce Momjian authored
      comparison;  also report the old/new values if they don't match.
      
      Backpatch to 9.2.
      b61837a4
  2. Oct 01, 2012
    • Tom Lane's avatar
      Provide some static-assertion functionality on all compilers. · 0d0aa5d2
      Tom Lane authored
      On reflection (especially after noticing how many buildfarm critters have
      __builtin_types_compatible_p but not _Static_assert), it seems like we
      ought to try a bit harder to make these macros do something everywhere.
      The initial cut at it would have been no help to code that is compiled only
      on platforms without _Static_assert, for instance; and in any case not all
      our contributors do their initial coding on the latest gcc version.
      
      Some googling about static assertions turns up quite a bit of prior art
      for making it work in compilers that lack _Static_assert.  The method
      that seems closest to our needs involves defining a struct with a bit-field
      that has negative width if the assertion condition fails.  There seems no
      reliable way to get the error message string to be output, but throwing a
      compile error with a confusing message is better than missing the problem
      altogether.
      
      In the same spirit, if we don't have __builtin_types_compatible_p we can at
      least insist that the variable have the same width as the type.  This won't
      catch errors such as "wrong pointer type", but it's far better than
      nothing.
      
      In addition to changing the macro definitions, adjust a
      compile-time-constant Assert in contrib/hstore to use StaticAssertStmt,
      so we can get some buildfarm coverage on whether that macro behaves sanely
      or not.  There's surely more places that could be converted, but this is
      the first one I came across.
      0d0aa5d2
  3. Sep 27, 2012
  4. Sep 19, 2012
  5. Sep 06, 2012
  6. Sep 05, 2012
  7. Sep 04, 2012
  8. Sep 03, 2012
    • Andrew Dunstan's avatar
      Fix bugs in exec.c that prevented pg_upgrade working in Windows. · 6259678f
      Andrew Dunstan authored
      Backpatch to 9.2 - code before that is quite different and should
      not have these defects.
      6259678f
    • Tom Lane's avatar
      Fix pg_upgrade to cope with non-default unix_socket_directory scenarios. · f763b771
      Tom Lane authored
      When starting either an old or new postmaster, force it to place its Unix
      socket in the current directory.  This makes it even harder for accidental
      connections to occur during pg_upgrade, and also works around some
      scenarios where the default socket location isn't usable.  (For example,
      if the default location is something other than "/tmp", it might not exist
      during "make check".)
      
      When checking an already-running old postmaster, find out its actual socket
      directory location from postmaster.pid, if possible.  This dodges problems
      with an old postmaster having a configured location different from the
      default built into pg_upgrade's libpq.  We can't find that out if the old
      postmaster is pre-9.1, so also document how to cope with such scenarios
      manually.
      
      In support of this, centralize handling of the connection-related command
      line options passed to pg_upgrade's subsidiary programs, such as pg_dump.
      This should make future changes easier.
      
      Bruce Momjian and Tom Lane
      f763b771
  9. Aug 30, 2012
    • Alvaro Herrera's avatar
      Split tuple struct defs from htup.h to htup_details.h · c219d9b0
      Alvaro Herrera authored
      This reduces unnecessary exposure of other headers through htup.h, which
      is very widely included by many files.
      
      I have chosen to move the function prototypes to the new file as well,
      because that means htup.h no longer needs to include tupdesc.h.  In
      itself this doesn't have much effect in indirect inclusion of tupdesc.h
      throughout the tree, because it's also required by execnodes.h; but it's
      something to explore in the future, and it seemed best to do the htup.h
      change now while I'm busy with it.
      c219d9b0
  10. Aug 29, 2012
  11. Aug 28, 2012
  12. Aug 27, 2012
  13. Aug 23, 2012
  14. Aug 20, 2012
  15. Aug 15, 2012
    • Tom Lane's avatar
      Prevent access to external files/URLs via contrib/xml2's xslt_process(). · adc97d03
      Tom Lane authored
      libxslt offers the ability to read and write both files and URLs through
      stylesheet commands, thus allowing unprivileged database users to both read
      and write data with the privileges of the database server.  Disable that
      through proper use of libxslt's security options.
      
      Also, remove xslt_process()'s ability to fetch documents and stylesheets
      from external files/URLs.  While this was a documented "feature", it was
      long regarded as a terrible idea.  The fix for CVE-2012-3489 broke that
      capability, and rather than expend effort on trying to fix it, we're just
      going to summarily remove it.
      
      While the ability to write as well as read makes this security hole
      considerably worse than CVE-2012-3489, the problem is mitigated by the fact
      that xslt_process() is not available unless contrib/xml2 is installed,
      and the longstanding warnings about security risks from that should have
      discouraged prudent DBAs from installing it in security-exposed databases.
      
      Reported and fixed by Peter Eisentraut.
      
      Security: CVE-2012-3488
      adc97d03
  16. Aug 10, 2012
  17. Aug 07, 2012
  18. Aug 03, 2012
  19. Aug 02, 2012
    • Tom Lane's avatar
      Replace libpq's "row processor" API with a "single row" mode. · 41b9c845
      Tom Lane authored
      After taking awhile to digest the row-processor feature that was added to
      libpq in commit 92785dac, we've concluded
      it is over-complicated and too hard to use.  Leave the core infrastructure
      changes in place (that is, there's still a row processor function inside
      libpq), but remove the exposed API pieces, and instead provide a "single
      row" mode switch that causes PQgetResult to return one row at a time in
      separate PGresult objects.
      
      This approach incurs more overhead than proper use of a row processor
      callback would, since construction of a PGresult per row adds extra cycles.
      However, it is far easier to use and harder to break.  The single-row mode
      still affords applications the primary benefit that the row processor API
      was meant to provide, namely not having to accumulate large result sets in
      memory before processing them.  Preliminary testing suggests that we can
      probably buy back most of the extra cycles by micro-optimizing construction
      of the extra results, but that task will be left for another day.
      
      Marko Kreen
      41b9c845
  20. Jul 26, 2012
  21. Jul 23, 2012
    • Robert Haas's avatar
      Make pgbench vacuum before building indexes. · 46b2b7e0
      Robert Haas authored
      This is apparently faster than doing things the other way around when
      the scale factor is large.
      
      Along the way, adjust -n to suppress vacuuming during initialization
      as well as during test runs.
      
      Jeff Janes, with some small changes by me.
      46b2b7e0
Loading