1. 28 4月, 2011 2 次提交
    • T
      Add comments about the need to avoid uninitialized bits in datatype values. · 4f6c75b5
      Tom Lane 提交于
      There was already one recommendation in the documentation about writing
      C functions to ensure padding bytes are zeroes, but make it stronger.
      
      Also fix an example that was still using direct assignment to a varlena
      length word, which no longer works since the varvarlena changes.
      4f6c75b5
    • T
      Fix array- and path-creating functions to ensure padding bytes are zeroes. · 18c0b4ec
      Tom Lane 提交于
      Per recent discussion, it's important for all computed datums (not only the
      results of input functions) to not contain any ill-defined (uninitialized)
      bits.  Failing to ensure that can result in equal() reporting that
      semantically indistinguishable Consts are not equal, which in turn leads to
      bizarre and undesirable planner behavior, such as in a recent example from
      David Johnston.  We might eventually try to fix this in a general manner by
      allowing datatypes to define identity-testing functions, but for now the
      path of least resistance is to expect datatypes to force all unused bits
      into consistent states.
      
      Per some testing by Noah Misch, array and path functions seem to be the
      only ones presenting risks at the moment, so I looked through all the
      functions in adt/array*.c and geo_ops.c and fixed them as necessary.  In
      the array functions, the easiest/safest fix is to allocate result arrays
      with palloc0 instead of palloc.  Possibly in future someone will want to
      look into whether we can just zero the padding bytes, but that looks too
      complex for a back-patchable fix.  In the path functions, we already had a
      precedent in path_in for just zeroing the one known pad field, so duplicate
      that code as needed.
      
      Back-patch to all supported branches.
      18c0b4ec
  2. 27 4月, 2011 8 次提交
  3. 26 4月, 2011 13 次提交
  4. 25 4月, 2011 7 次提交
    • R
      02e6a115
    • R
      Regression tests for TOAST. · 97e83468
      Robert Haas 提交于
      Kevin Grittner, per discussion of bug #5989
      97e83468
    • R
      Fix SSI-related assertion failure. · b429519d
      Robert Haas 提交于
      Bug #5899, reported by Marko Tiikkaja.
      
      Heikki Linnakangas, reviewed by Kevin Grittner and Dan Ports.
      b429519d
    • A
      Adjust yywrap macro for non-reentrant scanners for MSVC. · 08a0c2da
      Andrew Dunstan 提交于
      The MSVC compiler complains if a macro is called with less arguments
      than its definition provides for. flex generates a macro with one
      argument for yywrap, but only supplies the argument for reentrant
      scanners, so we remove the useless argument in the non-reentrant
      case to silence the warning.
      08a0c2da
    • M
      In libecpg do not set an sqlda field that is 'reserved for future use' unless · 5948a6ee
      Michael Meskes 提交于
      we know what should be stored in there.
      5948a6ee
    • P
      Normalize whitespace in the arguments of <indexterm> · 94126062
      Peter Eisentraut 提交于
      Strip leading and trailing whitespace and replace interior whitespace
      by a single space.  This avoids problems with the index generator
      producing duplicate index entries for terms that differ only in
      whitespace.
      
      Commit dca30da3 actually fixed all the
      indexterm elements that would cause this problem at the moment, but in
      case it sneaks in again, we're set.
      94126062
    • T
      Improve cost estimation for aggregates and window functions. · e6a30a8c
      Tom Lane 提交于
      The previous coding failed to account properly for the costs of evaluating
      the input expressions of aggregates and window functions, as seen in a
      recent gripe from Claudio Freire.  (I said at the time that it wasn't
      counting these costs at all; but on closer inspection, it was effectively
      charging these costs once per output tuple.  That is completely wrong for
      aggregates, and not exactly right for window functions either.)
      
      There was also a hard-wired assumption that aggregates and window functions
      had procost 1.0, which is now fixed to respect the actual cataloged costs.
      
      The costing of WindowAgg is still pretty bogus, since it doesn't try to
      estimate the effects of spilling data to disk, but that seems like a
      separate issue.
      e6a30a8c
  5. 24 4月, 2011 7 次提交
    • B
      In pg_upgrade, only compile copy_file() on non-Win32 systems. · f6322b31
      Bruce Momjian 提交于
      Per report from Andrew Dunstan.
      f6322b31
    • T
      Improve findoidjoins to cover more cases. · 795c382e
      Tom Lane 提交于
      Teach the program and script to deal with OID-array referencing columns,
      which we now have several of.  Also, modify the recommended usage process
      to specify that the program should be run against the regression database
      rather than template1.  This lets it find numerous joins that cannot be
      found in template1 because the relevant catalogs are entirely empty.
      
      Together these changes add seventeen formerly-missed cases to the oidjoins
      regression test.
      795c382e
    • A
      Silence a few compiler warnings from gcc on MinGW. · d98711df
      Andrew Dunstan 提交于
      Most of these cast DWORD to int or unsigned int for printf type handling.
      This is safe even on 64 bit architectures because a DWORD is always 32 bits.
      
      In one case a variable is initialised to keep the compiler happy.
      d98711df
    • T
      970d8a39
    • T
      Hash indexes had better pass the index collation to support functions, too. · a0b75a41
      Tom Lane 提交于
      Per experimentation with contrib/citext, whose hash function assumes that
      it'll be passed a collation.
      a0b75a41
    • T
      Adjust comments about collate.linux.utf8 regression test. · 1abd146d
      Tom Lane 提交于
      This test should now work in any database with UTF8 encoding, regardless
      of the database's default locale.  The former restriction was really
      "doesn't work if default locale is C", and that was because of not handling
      mbstowcs/wcstombs correctly.
      1abd146d
    • T
      Fix char2wchar/wchar2char to support collations properly. · 2ab0796d
      Tom Lane 提交于
      These functions should take a pg_locale_t, not a collation OID, and should
      call mbstowcs_l/wcstombs_l where available.  Where those functions are not
      available, temporarily select the correct locale with uselocale().
      
      This change removes the bogus assumption that all locales selectable in
      a given database have the same wide-character conversion method; in
      particular, the collate.linux.utf8 regression test now passes with
      LC_CTYPE=C, so long as the database encoding is UTF8.
      
      I decided to move the char2wchar/wchar2char functions out of mbutils.c and
      into pg_locale.c, because they work on wchar_t not pg_wchar_t and thus
      don't really belong with the mbutils.c functions.  Keeping them where they
      were would have required importing pg_locale_t into pg_wchar.h somehow,
      which did not seem like a good plan.
      2ab0796d
  6. 23 4月, 2011 3 次提交
    • T
      Fix contrib/btree_gist to handle collations properly. · bb850306
      Tom Lane 提交于
      Make use of the collation attached to the index column, instead of
      hard-wiring DEFAULT_COLLATION_OID.  (Note: in theory this could require
      reindexing btree_gist indexes on textual columns, but I rather doubt anyone
      has one with a non-default declared collation as yet.)
      bb850306
    • T
      Make GIN and GIST pass the index collation to all their support functions. · ae20bf17
      Tom Lane 提交于
      Experimentation with contrib/btree_gist shows that the majority of the GIST
      support functions potentially need collation information.  Safest policy
      seems to be to pass it to all of them, instead of making assumptions about
      which ones could possibly need it.
      ae20bf17
    • T
      De-kludge contrib/btree_gin for collations. · 474ff212
      Tom Lane 提交于
      Using DEFAULT_COLLATION_OID in the comparePartial functions was not only
      a lame hack, but outright wrong, because the compare functions for
      collation-aware types were already responding to the declared index
      collation.  So comparePartial would have the wrong expectation about
      the index's sort order, possibly leading to missing matches for prefix
      searches.
      474ff212