1. 23 Apr, 2011 7 commits
    • Andrew Dunstan's avatar
      Silence a few compiler warnings from gcc on MinGW. · d98711df
      Andrew Dunstan authored
      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
    • Tom Lane's avatar
    • Tom Lane's avatar
      Hash indexes had better pass the index collation to support functions, too. · a0b75a41
      Tom Lane authored
      Per experimentation with contrib/citext, whose hash function assumes that
      it'll be passed a collation.
      a0b75a41
    • Tom Lane's avatar
      Adjust comments about collate.linux.utf8 regression test. · 1abd146d
      Tom Lane authored
      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
    • Tom Lane's avatar
      Fix char2wchar/wchar2char to support collations properly. · 2ab0796d
      Tom Lane authored
      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
    • Tom Lane's avatar
      Fix contrib/btree_gist to handle collations properly. · bb850306
      Tom Lane authored
      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
    • Tom Lane's avatar
      Make GIN and GIST pass the index collation to all their support functions. · ae20bf17
      Tom Lane authored
      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
  2. 22 Apr, 2011 5 commits
  3. 21 Apr, 2011 6 commits
    • Tom Lane's avatar
      Avoid possible divide-by-zero in gincostestimate. · 92647fc4
      Tom Lane authored
      Per report from Jeff Janes.
      92647fc4
    • Robert Haas's avatar
      Allow ALTER TYPE .. ADD ATTRIBUTE .. CASCADE to recurse to descendants. · a0e8df52
      Robert Haas authored
      Without this, adding an attribute to a typed table with an inheritance
      child fails, which is surprising.
      
      Noah Misch, with minor changes by me.
      a0e8df52
    • Robert Haas's avatar
      Fix use of incorrect constant RemoveRoleFromObjectACL. · 8ede4279
      Robert Haas authored
      This could cause failures when DROP OWNED BY attempt to remove default
      privileges on sequences.  Back-patching to 9.0.
      
      Shigeru Hanada
      8ede4279
    • Robert Haas's avatar
      Typo fix. · 0babcdf6
      Robert Haas authored
      0babcdf6
    • Robert Haas's avatar
      Allow ALTER TABLE name {OF type | NOT OF}. · 68739ba8
      Robert Haas authored
      This syntax allows a standalone table to be made into a typed table,
      or a typed table to be made standalone.  This is possibly a mildly
      useful feature in its own right, but the real motivation for this
      change is that we need it to make pg_upgrade work with typed tables.
      This doesn't actually fix that problem, but it's necessary
      infrastructure.
      
      Noah Misch
      68739ba8
    • Tom Lane's avatar
      Fix bugs in indexing of in-doubt HOT-updated tuples. · 520bcd9c
      Tom Lane authored
      If we find a DELETE_IN_PROGRESS HOT-updated tuple, it is impossible to know
      whether to index it or not except by waiting to see if the deleting
      transaction commits.  If it doesn't, the tuple might again be LIVE, meaning
      we have to index it.  So wait and recheck in that case.
      
      Also, we must not rely on ii_BrokenHotChain to decide that it's possible to
      omit tuples from the index.  That could result in omitting tuples that we
      need, particularly in view of yesterday's fixes to not necessarily set
      indcheckxmin (but it's broken even without that, as per my analysis today).
      Since this is just an extremely marginal performance optimization, dropping
      the test shouldn't hurt.
      
      These cases are only expected to happen in system catalogs (they're
      possible there due to early release of RowExclusiveLock in most
      catalog-update code paths).  Since reindexing of a system catalog isn't a
      particularly performance-critical operation anyway, there's no real need to
      be concerned about possible performance degradation from these changes.
      
      The worst aspects of this bug were introduced in 9.0 --- 8.x will always
      wait out a DELETE_IN_PROGRESS tuple.  But I think dropping index entries
      on the strength of ii_BrokenHotChain is dangerous even without that, so
      back-patch removal of that optimization to 8.3 and 8.4.
      520bcd9c
  4. 20 Apr, 2011 6 commits
    • Tom Lane's avatar
      Set indcheckxmin true when REINDEX fixes an invalid or not-ready index. · 9ad7e155
      Tom Lane authored
      Per comment from Greg Stark, it's less clear that HOT chains don't conflict
      with the index than it would be for a valid index.  So, let's preserve the
      former behavior that indcheckxmin does get set when there are
      potentially-broken HOT chains in this case.  This change does not cause any
      pg_index update that wouldn't have happened anyway, so we're not
      re-introducing the previous bug with pg_index updates, and surely the case
      is not significant from a performance standpoint; so let's be as
      conservative as possible.
      9ad7e155
    • Tom Lane's avatar
      Make plan_cluster_use_sort cope with no IndexOptInfo for the target index. · 5b8e4429
      Tom Lane authored
      The original coding assumed that such a case represents caller error, but
      actually get_relation_info will omit generating an IndexOptInfo for any
      index it thinks is unsafe to use.  Therefore, handle this case by returning
      "true" to indicate that a seqscan-and-sort is the preferred way to
      implement the CLUSTER operation.  New bug in 9.1, no backpatch needed.
      Per bug #5985 from Daniel Grace.
      5b8e4429
    • Peter Eisentraut's avatar
      Fix PL/Python traceback for error in separate file · 395fcac2
      Peter Eisentraut authored
      It assumed that the lineno from the traceback always refers to the
      PL/Python function.  If you created a PL/Python function that imports
      some code, runs it, and that code raises an exception, PLy_traceback
      would get utterly confused.
      
      Now we look at the file name reported with the traceback and only
      print the source line if it came from the PL/Python function.
      
      Jan Urbański
      395fcac2
    • Bruce Momjian's avatar
      Pg_upgrade C comment addition. · 0262251c
      Bruce Momjian authored
      Document why we do the missing new database check during the check
      phase.
      0262251c
    • Heikki Linnakangas's avatar
      Quotes in strings injected into bki file need to escaped. In particular, · 2b919118
      Heikki Linnakangas authored
      "People's Republic of China" locale on Windows was causing initdb to fail.
      
      This fixes bug #5818 reported by yulei. On master, this makes the mapping
      of "People's Republic of China" to just "China" obsolete. In 9.0 and 8.4,
      just fix the escaping. Earlier versions didn't have locale names in bki
      file.
      2b919118
    • Bruce Momjian's avatar
      Throw error for mismatched pg_upgrade clusters · 7228d029
      Bruce Momjian authored
      If someone removes the 'postgres' database from the old cluster and the
      new cluster has a 'postgres' database, the number of databases will not
      match.  We actually could upgrade such a setup, but it would violate the
      1-to-1 mapping of database counts, so we throw an error instead.
      
      Previously they got an error during the upgrade, and not at the check
      stage; PG 9.0.4 does the same.
      7228d029
  5. 19 Apr, 2011 11 commits
  6. 18 Apr, 2011 4 commits
  7. 17 Apr, 2011 1 commit
    • Tom Lane's avatar
      Fix assorted infelicities in collation handling in psql's describe.c. · c29abc8b
      Tom Lane authored
      In \d, be more careful to print collation only if it's not the default for
      the column's data type.  Avoid assuming that the name "default" is magic.
      
      Fix \d on a composite type so that it will print per-column collations.
      It's no longer the case that a composite type cannot have modifiers.
      (In consequence, the expected outputs for composite-type regression tests
      change.)
      
      Fix \dD so that it will print collation for a domain, again only if it's
      not the same as the base type's collation.
      c29abc8b