1. 09 5月, 2015 4 次提交
    • H
      Add macros to check if a filename is a WAL segment or other such file. · 179cdd09
      Heikki Linnakangas 提交于
      We had many instances of the strlen + strspn combination to check for that.
      This makes the code a bit easier to read.
      179cdd09
    • P
      Fix whitespace · 16c73e77
      Peter Eisentraut 提交于
      16c73e77
    • A
      Minor ON CONFLICT related comments and doc fixes. · e8898e91
      Andres Freund 提交于
      Geoff Winkless, Stephen Frost, Peter Geoghegan and me.
      e8898e91
    • R
      Teach autovacuum about multixact member wraparound. · 53bb309d
      Robert Haas 提交于
      The logic introduced in commit b69bf30b
      and repaired in commits 669c7d20 and
      7be47c56 helps to ensure that we don't
      overwrite old multixact member information while it is still needed,
      but a user who creates many large multixacts can still exhaust the
      member space (and thus start getting errors) while autovacuum stands
      idly by.
      
      To fix this, progressively ramp down the effective value (but not the
      actual contents) of autovacuum_multixact_freeze_max_age as member space
      utilization increases.  This makes autovacuum more aggressive and also
      reduces the threshold for a manual VACUUM to perform a full-table scan.
      
      This patch leaves unsolved the problem of ensuring that emergency
      autovacuums are triggered even when autovacuum=off.  We'll need to fix
      that via a separate patch.
      
      Thomas Munro and Robert Haas
      53bb309d
  2. 08 5月, 2015 5 次提交
    • S
      Remove reference to src/tools/backend/index.html · 195fbd40
      Stephen Frost 提交于
      src/tools/backend was removed back in 63f1ccd8, but
      backend/storage/lmgr/README didn't get the memo.
      
      Author: Amit Langote
      195fbd40
    • A
      Remove dependency on ordering in logical decoding upsert test. · 581f4f96
      Andres Freund 提交于
      Buildfarm member magpie sorted the output differently than intended by
      Peter. "Resolve" the problem by simply not aggregating, it's not that
      many lines.
      581f4f96
    • A
      Add support for INSERT ... ON CONFLICT DO NOTHING/UPDATE. · 168d5805
      Andres Freund 提交于
      The newly added ON CONFLICT clause allows to specify an alternative to
      raising a unique or exclusion constraint violation error when inserting.
      ON CONFLICT refers to constraints that can either be specified using a
      inference clause (by specifying the columns of a unique constraint) or
      by naming a unique or exclusion constraint.  DO NOTHING avoids the
      constraint violation, without touching the pre-existing row.  DO UPDATE
      SET ... [WHERE ...] updates the pre-existing tuple, and has access to
      both the tuple proposed for insertion and the existing tuple; the
      optional WHERE clause can be used to prevent an update from being
      executed.  The UPDATE SET and WHERE clauses have access to the tuple
      proposed for insertion using the "magic" EXCLUDED alias, and to the
      pre-existing tuple using the table name or its alias.
      
      This feature is often referred to as upsert.
      
      This is implemented using a new infrastructure called "speculative
      insertion". It is an optimistic variant of regular insertion that first
      does a pre-check for existing tuples and then attempts an insert.  If a
      violating tuple was inserted concurrently, the speculatively inserted
      tuple is deleted and a new attempt is made.  If the pre-check finds a
      matching tuple the alternative DO NOTHING or DO UPDATE action is taken.
      If the insertion succeeds without detecting a conflict, the tuple is
      deemed inserted.
      
      To handle the possible ambiguity between the excluded alias and a table
      named excluded, and for convenience with long relation names, INSERT
      INTO now can alias its target table.
      
      Bumps catversion as stored rules change.
      
      Author: Peter Geoghegan, with significant contributions from Heikki
          Linnakangas and Andres Freund. Testing infrastructure by Jeff Janes.
      Reviewed-By: Heikki Linnakangas, Andres Freund, Robert Haas, Simon Riggs,
          Dean Rasheed, Stephen Frost and many others.
      168d5805
    • A
      Represent columns requiring insert and update privileges indentently. · 2c8f4836
      Andres Freund 提交于
      Previously, relation range table entries used a single Bitmapset field
      representing which columns required either UPDATE or INSERT privileges,
      despite the fact that INSERT and UPDATE privileges are separately
      cataloged, and may be independently held.  As statements so far required
      either insert or update privileges but never both, that was
      sufficient. The required permission could be inferred from the top level
      statement run.
      
      The upcoming INSERT ... ON CONFLICT UPDATE feature needs to
      independently check for both privileges in one statement though, so that
      is not sufficient anymore.
      
      Bumps catversion as stored rules change.
      
      Author: Peter Geoghegan
      Reviewed-By: Andres Freund
      2c8f4836
    • A
      Improve BRIN infra, minmax opclass and regression test · db5f98ab
      Alvaro Herrera 提交于
      The minmax opclass was using the wrong support functions when
      cross-datatypes queries were run.  Instead of trying to fix the
      pg_amproc definitions (which apparently is not possible), use the
      already correct pg_amop entries instead.  This requires jumping through
      more hoops (read: extra syscache lookups) to obtain the underlying
      functions to execute, but it is necessary for correctness.
      
      Author: Emre Hasegeli, tweaked by Álvaro
      Review: Andreas Karlsson
      
      Also change BrinOpcInfo to record each stored type's typecache entry
      instead of just the OID.  Turns out that the full type cache is
      necessary in brin_deform_tuple: the original code used the indexed
      type's byval and typlen properties to extract the stored tuple, which is
      correct in Minmax; but in other implementations that want to store
      something different, that's wrong.  The realization that this is a bug
      comes from Emre also, but I did not use his patch.
      
      I also adopted Emre's regression test code (with smallish changes),
      which is more complete.
      db5f98ab
  3. 07 5月, 2015 5 次提交
  4. 06 5月, 2015 5 次提交
    • R
      Avoid using a C++ keyword as a structure member name. · 19982610
      Robert Haas 提交于
      Per request from Peter Eisentraut.
      19982610
    • T
      929ca965
    • T
      Fix incorrect declaration of citext's regexp_matches() functions. · b22527f2
      Tom Lane 提交于
      These functions should return SETOF TEXT[], like the core functions they
      are wrappers for; but they were incorrectly declared as returning just
      TEXT[].  This mistake had two results: first, if there was no match you got
      a scalar null result, whereas what you should get is an empty set (zero
      rows).  Second, the 'g' flag was effectively ignored, since you would get
      only one result array even if there were multiple matches, as reported by
      Jeff Certain.
      
      While ignoring 'g' is a clear bug, the behavior for no matches might well
      have been thought to be the intended behavior by people who hadn't compared
      it carefully to the core regexp_matches() functions.  So we should tread
      carefully about introducing this change in the back branches.  Still, it
      clearly is a bug and so providing some fix is desirable.
      
      After discussion, the conclusion was to introduce the change in a 1.1
      version of the citext extension (as we would need to do anyway); 1.0 still
      contains the incorrect behavior.  1.1 is the default and only available
      version in HEAD, but it is optional in the back branches, where 1.0 remains
      the default version.  People wishing to adopt the fix in back branches will
      need to explicitly do ALTER EXTENSION citext UPDATE TO '1.1'.  (I also
      provided a downgrade script in the back branches, so people could go back
      to 1.0 if necessary.)
      
      This should be called out as an incompatible change in the 9.5 release
      notes, although we'll also document it in the next set of back-branch
      release notes.  The notes should mention that any views or rules that use
      citext's regexp_matches() functions will need to be dropped before
      upgrading to 1.1, and then recreated again afterwards.
      
      Back-patch to 9.1.  The bug goes all the way back to citext's introduction
      in 8.4, but pre-9.1 there is no extension mechanism with which to manage
      the change.  Given the lack of previous complaints it seems unnecessary to
      change this behavior in 9.0, anyway.
      b22527f2
    • P
    • A
      Add geometry/range functions to support BRIN inclusion · 3b6db1f4
      Alvaro Herrera 提交于
      This commit adds the following functions:
          box(point) -> box
          bound_box(box, box) -> box
          inet_same_family(inet, inet) -> bool
          inet_merge(inet, inet) -> cidr
          range_merge(anyrange, anyrange) -> anyrange
      
      The first of these is also used to implement a new assignment cast from
      point to box.
      
      These functions are the first part of a base to implement an "inclusion"
      operator class for BRIN, for multidimensional data types.
      
      Author: Emre Hasegeli
      Reviewed by: Andreas Karlsson
      3b6db1f4
  5. 05 5月, 2015 8 次提交
    • R
      Fix some problems with patch to fsync the data directory. · 456ff086
      Robert Haas 提交于
      pg_win32_is_junction() was a typo for pgwin32_is_junction().  open()
      was used not only in a two-argument form, which breaks on Windows,
      but also where BasicOpenFile() should have been used.
      
      Per reports from Andrew Dunstan and David Rowley.
      456ff086
    • P
      hstore_plpython: Support tests on Python 2.3 · c0574cd5
      Peter Eisentraut 提交于
      Python 2.3 does not have the sorted() function, so do it the long way.
      c0574cd5
    • P
      Fix typos · ad8d6d06
      Peter Eisentraut 提交于
      Author: Erik Rijkers <er@xs4all.nl>
      ad8d6d06
    • R
      Use outerPlanState macro instead of referring to leffttree. · 40f42d2a
      Robert Haas 提交于
      This makes the executor code more consistent.  It also removes
      an apparently superfluous NULL test in nodeGroup.c.
      
      Qingqing Zhou, reviewed by Tom Lane, and further revised by me.
      40f42d2a
    • T
      Improve procost estimates for some text search functions. · 2503982b
      Tom Lane 提交于
      The text search functions that involve parsing raw text into lexemes are
      remarkably CPU-intensive, so estimating them at the same cost as most other
      built-in functions seems like a mistake; moreover, doing so turns out to
      discourage the optimizer from using functional indexes on these functions.
      After some debate, we've agreed to raise procost from 1 to 100 for
      to_tsvector(), plainto_tsvector(), to_tsquery(), ts_headline(),
      ts_match_tt(), and ts_match_tq(), which are all the text search functions
      that parse raw text.
      
      Also increase procost for the 2-argument form of ts_rewrite()
      (tsquery_rewrite_query); while this function doesn't do text parsing,
      it does execute a user-supplied SQL query, so its previous procost of 1 is
      clearly a drastic underestimate.  It seems reasonable to assign it the same
      cost we assign to PL functions by default, so 100 is the number here too.
      
      I did not bother bumping catversion for this change, since it does not
      break catalog compatibility with the server executable nor result in
      any regression test changes.
      
      Per complaint from Andrew Gierth and subsequent discussion.
      2503982b
    • R
      Recursively fsync() the data directory after a crash. · 2ce439f3
      Robert Haas 提交于
      Otherwise, if there's another crash, some writes from after the first
      crash might make it to disk while writes from before the crash fail
      to make it to disk.  This could lead to data corruption.
      
      Back-patch to all supported versions.
      
      Abhijit Menon-Sen, reviewed by Andres Freund and slightly revised
      by me.
      2ce439f3
    • H
      Fix the same-rel optimization when creating WAL records. · ec3d976b
      Heikki Linnakangas 提交于
      prev_regbuf was never set, and therefore the same-rel flag was never set on
      WAL records.
      
      Report and fix by Zhanq Zq
      ec3d976b
    • A
      Fix two small bugs in json's populate_record_worker · 3c000fd9
      Andrew Dunstan 提交于
      The first bug is not releasing a tupdesc when doing an early return out
      of the function. The second bug is a logic error in choosing when to do
      an early return if given an empty jsonb object.
      
      Bug reports from Pavel Stehule and Tom Lane respectively.
      
      Backpatch to 9.4 where these were introduced.
      3c000fd9
  6. 04 5月, 2015 1 次提交
    • T
      Second try at fixing warnings caused by commit 9b43d73b. · c90b85e4
      Tom Lane 提交于
      Commit ef3f9e64 suppressed one cause of warnings here, but
      recent clang on OS X is still unhappy because we're passing a "long"
      to abs().  The fact that tm_gmtoff is declared as long is no doubt a
      hangover from days when int might be only 16 bits; but Postgres has
      never been able to run on such machines, so we can just cast it to int
      with no worries.  For consistency, also cast to int in the other
      uses of tm_gmtoff in this stanza.
      
      Note: this code is still broken on machines that don't follow C99
      integer-division-truncates-towards-zero rules.  Given the lack of
      complaints about it, I don't feel a large desire to complicate things
      enough to cope with the pre-C99 rules.
      c90b85e4
  7. 03 5月, 2015 8 次提交
  8. 02 5月, 2015 4 次提交
    • P
      hstore_plperl: Move port-specific parts to later in the makefile · e30a8649
      Peter Eisentraut 提交于
      PORTNAME isn't set until the global makefiles have been included.
      e30a8649
    • P
      Fix shared libpython detection on OS X · 010aa420
      Peter Eisentraut 提交于
      Apparently, looking for an appropriately named file doesn't work on some
      older versions, so put the back the explicit platform detection.
      010aa420
    • P
      Make hstore_plperl's build even more like plperl's · 0fd76464
      Peter Eisentraut 提交于
      Combine the two places that set CPPFLAGS into one.  Also, some settings
      should be restricted to Windows only.  More precisely, -Wno-comment is
      a GCC-only option, but Windows in a makefile implies GCC at the moment.
      
      Also, since -Wno-comment is more properly a preprocessor option, move it
      to CPPFLAGS to simplify things a bit.
      0fd76464
    • P
      Move interpreter shared library detection to configure · d664a10f
      Peter Eisentraut 提交于
      For building PL/Perl, PL/Python, and PL/Tcl, we need a shared library of
      libperl, libpython, and libtcl, respectively.  Previously, this was
      checked in the makefiles, skipping the PL build with a warning if no
      shared library was available.  Now this is checked in configure, with an
      error if no shared library is available.
      
      The previous situation arose because in the olden days, the configure
      options --with-perl, --with-python, and --with-tcl controlled whether
      frontend interfaces for those languages would be built.  The procedural
      languages were added later, and shared libraries were often not
      available in the beginning.  So it was decided skip the builds of the
      procedural languages in those cases.  The frontend interfaces have since
      been removed from the tree, and shared libraries are now available most
      of the time, so that setup makes much less sense now.
      
      Also, the new setup allows contrib modules and pgxs users to rely on the
      respective PLs being available based on configure flags.
      d664a10f