1. 04 9月, 2011 7 次提交
    • T
      Clean up the #include mess a little. · 1609797c
      Tom Lane 提交于
      walsender.h should depend on xlog.h, not vice versa.  (Actually, the
      inclusion was circular until a couple hours ago, which was even sillier;
      but Bruce broke it in the expedient rather than logically correct
      direction.)  Because of that poor decision, plus blind application of
      pgrminclude, we had a situation where half the system was depending on
      xlog.h to include such unrelated stuff as array.h and guc.h.  Clean up
      the header inclusion, and manually revert a lot of what pgrminclude had
      done so things build again.
      
      This episode reinforces my feeling that pgrminclude should not be run
      without adult supervision.  Inclusion changes in header files in particular
      need to be reviewed with great care.  More generally, it'd be good if we
      had a clearer notion of module layering to dictate which headers can sanely
      include which others ... but that's a big task for another day.
      1609797c
    • T
      Remove unnecessary and circular #include. · f116b1f5
      Tom Lane 提交于
      storage/proc.h should not include replication/syncrep.h, especially not
      when the latter includes storage/proc.h; but in any case this was a pretty
      poor thing from a modular layering standpoint.
      f116b1f5
    • B
      walsender.h doesn't need xlog.h, per Tom. · 5bce637a
      Bruce Momjian 提交于
      5bce637a
    • B
      Move AllowCascadeReplication() define from xlog.h to replication include · 85e6e166
      Bruce Momjian 提交于
      file.
      
      Per suggestion from Alvaro.
      85e6e166
    • B
      Remove find_lt sgml tool, as it is not needed. · ca598c18
      Bruce Momjian 提交于
      Per suggestion from Peter.
      ca598c18
    • T
      Fix typo in pg_srand48 (srand48 in older branches). · 48e4b8dc
      Tom Lane 提交于
      ">" should be ">>".  This typo results in failure to use all of the bits
      of the provided seed.
      
      This might rise to the level of a security bug if we were relying on
      srand48 for any security-critical purposes, but we are not --- in fact,
      it's not used at all unless the platform lacks srandom(), which is
      improbable.  Even on such a platform the exposure seems minimal.
      
      Reported privately by Andres Freund.
      48e4b8dc
    • T
      Rearrange planner to save the whole PlannerInfo (subroot) for a subquery. · b3aaf908
      Tom Lane 提交于
      Formerly, set_subquery_pathlist and other creators of plans for subqueries
      saved only the rangetable and rowMarks lists from the lower-level
      PlannerInfo.  But there's no reason not to remember the whole PlannerInfo,
      and indeed this turns out to simplify matters in a number of places.
      
      The immediate reason for doing this was so that the subroot will still be
      accessible when we're trying to extract column statistics out of an
      already-planned subquery.  But now that I've done it, it seems like a good
      code-beautification effort in its own right.
      
      I also chose to get rid of the transient subrtable and subrowmark fields in
      SubqueryScan nodes, in favor of having setrefs.c look up the subquery's
      RelOptInfo.  That required changing all the APIs in setrefs.c to pass
      PlannerInfo not PlannerGlobal, which was a large but quite mechanical
      transformation.
      
      One side-effect not foreseen at the beginning is that this finally broke
      inheritance_planner's assumption that replanning the same subquery RTE N
      times would necessarily give interchangeable results each time.  That
      assumption was always pretty risky, but now we really have to make a
      separate RTE for each instance so that there's a place to carry the
      separate subroots.
      b3aaf908
  2. 03 9月, 2011 3 次提交
    • P
      Add archive_command example · 42ad992f
      Peter Eisentraut 提交于
      42ad992f
    • P
      f1e4f3d4
    • T
      Teach ANALYZE to clear pg_class.relhassubclass when appropriate. · 5b562644
      Tom Lane 提交于
      In the past, relhassubclass always remained true if a relation had ever had
      child relations, even if the last subclass was long gone.  While this had
      only marginal performance implications in most cases, it was annoying, and
      I'm now considering some planner changes that would raise the cost of a
      false positive.  It was previously impractical to fix this because of race
      condition concerns.  However, given the recent change that made tablecmds.c
      take ShareExclusiveLock on relations that are gaining a child (commit
      fbcf4b92), we can now allow ANALYZE to
      clear the flag when it's no longer relevant.  There is no additional
      locking cost to do so, since ANALYZE takes ShareExclusiveLock anyway.
      5b562644
  3. 02 9月, 2011 5 次提交
  4. 01 9月, 2011 16 次提交
    • T
      Put back improperly removed #include. · e5b012b7
      Tom Lane 提交于
      e5b012b7
    • B
      Add C comment about necessary NetBSD include. · 7805b118
      Bruce Momjian 提交于
      7805b118
    • B
      Add missing hba.h include for NetBSD. · 5352bf39
      Bruce Momjian 提交于
      5352bf39
    • B
      b3d32eba
    • B
      6416a82a
    • M
      In ecpglib restore LC_NUMERIC in case of an error. · 63d06ef5
      Michael Meskes 提交于
      63d06ef5
    • R
      Minor improvements to mbregress.sh script. · 48fb49e3
      Robert Haas 提交于
      1. Use new dropdb --if-exists option, to avoid alarming the user if
         the database being dropped doesn't already exist.
      2. Bail out if createdb fails.
      3. exit 1 if the checks fail.
      4. Make it executable.
      
      Josh Kupershmidt, with some kibitzing by me.
      48fb49e3
    • R
      Userspace access vector cache for contrib/sepgsql. · 4232c4b4
      Robert Haas 提交于
      KaiGai Kohei
      4232c4b4
    • R
      Fix "is db labeled test?" in chkselinuxenv script. · 3d14bd25
      Robert Haas 提交于
      Don't test whether the number of labels is numerically equal to zero;
      count(*) isn't going return zero anyway, and the current coding blows
      up if it returns an empty string or an error.
      3d14bd25
    • B
      Remove "fmgr.h" include in cube contrib --- caused crash on a Gentoo · d5321842
      Bruce Momjian 提交于
      builfarm member.
      d5321842
    • H
      Fix MinGW build, broken by my previous patch to add a setlocale() wrapper · 65e899b2
      Heikki Linnakangas 提交于
      on Windows. ecpglib doesn't link with libpgport, but picks and compiles
      the .c files it needs individually. To cope with that, move the setlocale()
      wrapper from chklocale.c to a separate setlocale.c file, and include that
      in ecpglib.
      65e899b2
    • H
      setlocale() on Windows doesn't work correctly if the locale name contains · a88b6e4c
      Heikki Linnakangas 提交于
      dots. I previously worked around this in initdb, mapping the known
      problematic locale names to aliases that work, but Hiroshi Inoue pointed
      out that that's not enough because even if you use one of the aliases, like
      "Chinese_HKG", setlocale(LC_CTYPE, NULL) returns back the long form, ie.
      "Chinese_Hong Kong S.A.R.". When we try to restore an old locale value by
      passing that value back to setlocale(), it fails. Note that you are affected
      by this bug also if you use one of those short-form names manually, so just
      reverting the hack in initdb won't fix it.
      
      To work around that, move the locale name mapping from initdb to a wrapper
      around setlocale(), so that the mapping is invoked on every setlocale() call.
      
      Also, add a few checks for failed setlocale() calls in the backend. These
      calls shouldn't fail, and if they do there isn't much we can do about it,
      but at least you'll get a warning.
      
      Backpatch to 9.1, where the initdb hack was introduced. The Windows bug
      affects older versions too if you set locale manually to one of the aliases,
      but given the lack of complaints from the field, I'm hesitent to backpatch.
      a88b6e4c
    • H
      Move the line to undefine setlocale() macro on Win32 outside USE_REPL_SNPRINTF · 8ea02570
      Heikki Linnakangas 提交于
      ifdef block. It has nothing to do with whether the replacement snprintf
      function is used. It caused no live bug, because the replacement snprintf
      function is always used on Win32, but it was nevertheless misplaced.
      8ea02570
    • T
      Further repair of eqjoinsel ndistinct-clamping logic. · 0d3b231e
      Tom Lane 提交于
      Examination of examples provided by Mark Kirkwood and others has convinced
      me that actually commit 7f3eba30 was quite
      a few bricks shy of a load.  The useful part of that patch was clamping
      ndistinct for the inner side of a semi or anti join, and the reason why
      that's needed is that it's the only way that restriction clauses
      eliminating rows from the inner relation can affect the estimated size of
      the join result.  I had not clearly understood why the clamping was
      appropriate, and so mis-extrapolated to conclude that we should clamp
      ndistinct for the outer side too, as well as for both sides of regular
      joins.  These latter actions were all wrong, and are reverted with this
      patch.  In addition, the clamping logic is now made to affect the behavior
      of both paths in eqjoinsel_semi, with or without MCV lists to compare.
      When we have MCVs, we suppose that the most common values are the ones
      that are most likely to survive the decimation resulting from a lower
      restriction clause, so we think of the clamping as eliminating non-MCV
      values, or potentially even the least-common MCVs for the inner relation.
      
      Back-patch to 8.4, same as previous fixes in this area.
      0d3b231e
    • B
      Fix pg_upgrade to preserve toast relfrozenxids for old 8.3 servers. · 7971a57f
      Bruce Momjian 提交于
      This fixes a pg_upgrade bug that could lead to query errors when
      clog files are improperly removed.
      
      Backpatch to 8.4, 9.0, 9.1.
      7971a57f
    • T
      Improve eqjoinsel's ndistinct clamping to work for multiple levels of join. · 97930cf5
      Tom Lane 提交于
      This patch fixes an oversight in my commit
      7f3eba30 of 2008-10-23.  That patch
      accounted for baserel restriction clauses that reduced the number of rows
      coming out of a table (and hence the number of possibly-distinct values of
      a join variable), but not for join restriction clauses that might have been
      applied at a lower level of join.  To account for the latter, look up the
      sizes of the min_lefthand and min_righthand inputs of the current join,
      and clamp with those in the same way as for the base relations.
      
      Noted while investigating a complaint from Ben Chobot, although this in
      itself doesn't seem to explain his report.
      
      Back-patch to 8.4; previous versions used different estimation methods
      for which this heuristic isn't relevant.
      97930cf5
  5. 31 8月, 2011 8 次提交
  6. 30 8月, 2011 1 次提交