1. 17 7月, 2012 3 次提交
    • P
      Remove unreachable code · dd16f948
      Peter Eisentraut 提交于
      The Solaris Studio compiler warns about these instances, unlike more
      mainstream compilers such as gcc.  But manual inspection showed that
      the code is clearly not reachable, and we hope no worthy compiler will
      complain about removing this code.
      dd16f948
    • P
      Add comment why seemingly dead code is necessary · a76c857e
      Peter Eisentraut 提交于
      a76c857e
    • T
      Avoid pre-determining index names during CREATE TABLE LIKE parsing. · c92be3c0
      Tom Lane 提交于
      Formerly, when trying to copy both indexes and comments, CREATE TABLE LIKE
      had to pre-assign names to indexes that had comments, because it made up an
      explicit CommentStmt command to apply the comment and so it had to know the
      name for the index.  This creates bad interactions with other indexes, as
      shown in bug #6734 from Daniele Varrazzo: the preassignment logic couldn't
      take any other indexes into account so it could choose a conflicting name.
      
      To fix, add a field to IndexStmt that allows it to carry a comment to be
      assigned to the new index.  (This isn't a user-exposed feature of CREATE
      INDEX, only an internal option.)  Now we don't need preassignment of index
      names in any situation.
      
      I also took the opportunity to refactor DefineIndex to accept the IndexStmt
      as such, rather than passing all its fields individually in a mile-long
      parameter list.
      
      Back-patch to 9.2, but no further, because it seems too dangerous to change
      IndexStmt or DefineIndex's API in released branches.  The bug exists back
      to 9.0 where CREATE TABLE LIKE grew the ability to copy comments, but given
      the lack of prior complaints we'll just let it go unfixed before 9.2.
      c92be3c0
  2. 16 7月, 2012 1 次提交
    • T
      Prevent corner-case core dump in rfree(). · 54fd196f
      Tom Lane 提交于
      rfree() failed to cope with the case that pg_regcomp() had initialized the
      regex_t struct but then failed to allocate any memory for re->re_guts (ie,
      the first malloc call in pg_regcomp() failed).  It would try to touch the
      guts struct anyway, and thus dump core.  This is a sufficiently narrow
      corner case that it's not surprising it's never been seen in the field;
      but still a bug is a bug, so patch all active branches.
      
      Noted while investigating whether we need to call pg_regfree after a
      failure return from pg_regcomp.  Other than this bug, it turns out we
      don't, so adjust comments appropriately.
      54fd196f
  3. 15 7月, 2012 1 次提交
  4. 14 7月, 2012 3 次提交
    • H
      Print the name of the WAL file containing latest REDO ptr in pg_controldata. · 6c349a56
      Heikki Linnakangas 提交于
      This makes it easier to determine how far back you need to keep archived WAL
      files, to restore from a backup.
      
      Fujii Masao
      6c349a56
    • P
      8e708e5e
    • T
      Add fsync capability to initdb, and use sync_file_range() if available. · b966dd6c
      Tom Lane 提交于
      Historically we have not worried about fsync'ing anything during initdb
      (in fact, initdb intentionally passes -F to each backend launch to prevent
      it from fsync'ing).  But with filesystems getting more aggressive about
      caching data, that's not such a good plan anymore.  Make initdb do a pass
      over the finished data directory tree to fsync everything.  For testing
      purposes, the -N/--nosync flag can be used to restore the old behavior.
      
      Also, testing shows that on Linux, sync_file_range() is much faster than
      posix_fadvise() for hinting to the kernel that an fsync is coming,
      apparently because the latter blocks on a rather small request queue while
      the former doesn't.  So use this function if available in initdb, and also
      in the backend's pg_flush_data() (where it currently will affect only the
      speed of CREATE DATABASE's cloning step).
      
      We will later make pg_regress invoke initdb with the --nosync flag
      to avoid slowing down cases such as "make check" in contrib.  But
      let's not do so until we've shaken out any portability issues in this
      patch.
      
      Jeff Davis, reviewed by Andres Freund
      b966dd6c
  5. 13 7月, 2012 4 次提交
  6. 12 7月, 2012 2 次提交
  7. 11 7月, 2012 7 次提交
    • B
      Document that Log-Shipping Standby Servers cannot be upgraded by · f9951252
      Bruce Momjian 提交于
      pg_upgrade.
      
      Backpatch to 9.2.
      f9951252
    • T
      Fix bogus macro definition. · 01215d61
      Tom Lane 提交于
      Per buildfarm complaints.
      01215d61
    • T
      Add comments about additional mule-internal charsets from emacs's · 1c7a7faa
      Tatsuo Ishii 提交于
      source code(lisp/international/mule-conf.el).  These charsets have not
      been supported up to now anyway, so this is just for adding
      commentary.  Also add mention that we follow emacs's implementation,
      not xemacs's.
      1c7a7faa
    • T
      Fix ASCII case in pg_wchar2mule_with_len. · 60e9c224
      Tom Lane 提交于
      Also some cosmetic improvements for wchar-to-mblen patch.
      60e9c224
    • A
      plperl: Skip setting UTF8 flag when in SQL_ASCII encoding · 379607c9
      Alvaro Herrera 提交于
      When in SQL_ASCII encoding, strings passed around are not necessarily
      UTF8-safe.  We had already fixed this in some places, but it looks like
      we missed some.
      
      I had to backpatch Peter Eisentraut's a8b92b60 to 9.1 in order for this
      patch to cherry-pick more cleanly.
      
      Patch from Alex Hunsaker, tweaked by Kyotaro HORIGUCHI and myself.
      
      Some desultory cleanup and comment addition by me, during patch review.
      
      Per bug report from Christoph Berg in
      20120209102116.GA14429@msgid.df7cb.de
      379607c9
    • A
      perltidy adjustments to new file · fc4a8a6d
      Alvaro Herrera 提交于
      fc4a8a6d
    • T
      Re-implement extraction of fixed prefixes from regular expressions. · 628cbb50
      Tom Lane 提交于
      To generate btree-indexable conditions from regex WHERE conditions (such as
      WHERE indexed_col ~ '^foo'), we need to be able to identify any fixed
      prefix that a regex might have; that is, find any string that must be a
      prefix of all strings satisfying the regex.  We used to do that with
      entirely ad-hoc code that looked at the source text of the regex.  It
      didn't know very much about regex syntax, which mostly meant that it would
      fail to identify some optimizable cases; but Viktor Rosenfeld reported that
      it would produce actively wrong answers for quantified parenthesized
      subexpressions, such as '^(foo)?bar'.  Rather than trying to extend the
      ad-hoc code to cover this, let's get rid of it altogether in favor of
      identifying prefixes by examining the compiled form of a regex.
      
      To do this, I've added a new entry point "pg_regprefix" to the regex library;
      hopefully it is defined in a sufficiently general fashion that it can remain
      in the library when/if that code gets split out as a standalone project.
      
      Since this bug has been there for a very long time, this fix needs to get
      back-patched.  However it depends on some other recent commits (particularly
      the addition of wchar-to-database-encoding conversion), so I'll commit this
      separately and then go to work on back-porting the necessary fixes.
      628cbb50
  8. 10 7月, 2012 1 次提交
    • T
      Refactor pattern_fixed_prefix() to avoid dealing in incomplete patterns. · 00dac600
      Tom Lane 提交于
      Previously, pattern_fixed_prefix() was defined to return whatever fixed
      prefix it could extract from the pattern, plus the "rest" of the pattern.
      That definition was sensible for LIKE patterns, but not so much for
      regexes, where reconstituting a valid pattern minus the prefix could be
      quite tricky (certainly the existing code wasn't doing that correctly).
      Since the only thing that callers ever did with the "rest" of the pattern
      was to pass it to like_selectivity() or regex_selectivity(), let's cut out
      the middle-man and just have pattern_fixed_prefix's subroutines do this
      directly.  Then pattern_fixed_prefix can return a simple selectivity
      number, and the question of how to cope with partial patterns is removed
      from its API specification.
      
      While at it, adjust the API spec so that callers who don't actually care
      about the pattern's selectivity (which is a lot of them) can pass NULL for
      the selectivity pointer to skip doing the work of computing a selectivity
      estimate.
      
      This patch is only an API refactoring that doesn't actually change any
      processing, other than allowing a little bit of useless work to be skipped.
      However, it's necessary infrastructure for my upcoming fix to regex prefix
      extraction, because after that change there won't be any simple way to
      identify the "rest" of the regex, not even to the low level of fidelity
      needed by regex_selectivity.  We can cope with that if regex_fixed_prefix
      and regex_selectivity communicate directly, but not if we have to work
      within the old API.  Hence, back-patch to all active branches.
      00dac600
  9. 09 7月, 2012 1 次提交
    • T
      Fix planner to pass correct collation to operator selectivity estimators. · e7ef6d7e
      Tom Lane 提交于
      We can do this without creating an API break for estimation functions
      by passing the collation using the existing fmgr functionality for
      passing an input collation as a hidden parameter.
      
      The need for this was foreseen at the outset, but we didn't get around to
      making it happen in 9.1 because of the decision to sort all pg_statistic
      histograms according to the database's default collation.  That meant that
      selectivity estimators generally need to use the default collation too,
      even if they're estimating for an operator that will do something
      different.  The reason it's suddenly become more interesting is that
      regexp interpretation also uses a collation (for its LC_TYPE not LC_COLLATE
      property), and we no longer want to use the wrong collation when examining
      regexps during planning.  It's not that the selectivity estimate is likely
      to change much from this; rather that we are thinking of caching compiled
      regexps during planner estimation, and we won't get the intended benefit
      if we cache them with a different collation than the executor will use.
      
      Back-patch to 9.1, both because the regexp change is likely to get
      back-patched and because we might as well get this right in all
      collation-supporting branches, in case any third-party code wants to
      rely on getting the collation.  The patch turns out to be minuscule
      now that I've done it ...
      e7ef6d7e
  10. 08 7月, 2012 1 次提交
    • T
      Simplify and document regex library's compact-NFA representation. · c6aae304
      Tom Lane 提交于
      The previous coding abused the first element of a cNFA state's arcs list
      to hold a per-state flag bit, which was confusing, undocumented, and not
      even particularly efficient.  Get rid of that in favor of a separate
      "stflags" vector.  Since there's only one bit in use, I chose to allocate a
      char per state; we could possibly replace this with a bitmap at some point,
      but that would make accesses a little slower.  It's already about 8X
      smaller than before, so let's not get overly tense.
      
      Also document the representation better than it was before, which is to say
      not at all.
      
      This patch is a byproduct of investigations towards extracting a "fixed
      prefix" string from the compact-NFA representation of regex patterns.
      Might need to back-patch it if we decide to back-patch that fix, but for
      now it's just code cleanup so I'll just put it in HEAD.
      c6aae304
  11. 07 7月, 2012 4 次提交
  12. 06 7月, 2012 10 次提交
  13. 05 7月, 2012 2 次提交