1. 18 Jul, 2014 1 commit
    • Tom Lane's avatar
      Fix two low-probability memory leaks in regular expression parsing. · 1567e659
      Tom Lane authored
      If pg_regcomp failed after having invoked markst/cleanst, it would leak any
      "struct subre" nodes it had created.  (We've already detected all regex
      syntax errors at that point, so the only likely causes of later failure
      would be query cancel or out-of-memory.)  To fix, make sure freesrnode
      knows the difference between the pre-cleanst and post-cleanst cleanup
      procedures.  Add some documentation of this less-than-obvious point.
      
      Also, newlacon did the wrong thing with an out-of-memory failure from
      realloc(), so that the previously allocated array would be leaked.
      
      Both of these are pretty low-probability scenarios, but a bug is a bug,
      so patch all the way back.
      
      Per bug #10976 from Arthur O'Dwyer.
      1567e659
  2. 17 Jul, 2014 3 commits
    • Magnus Hagander's avatar
      Revert broken change to pgevent.c · 6cd471a6
      Magnus Hagander authored
      pgevent doesn't include the global PostgreSQL headers, for a reason,
      and therefor cannot rely on defines in it...
      6cd471a6
    • Magnus Hagander's avatar
      Add option to pg_ctl to choose event source for logging · c0e4520b
      Magnus Hagander authored
      pg_ctl will log to the Windows event log when it is running as a service,
      which is the primary way of running PostgreSQL on Windows. This option
      makes it possible to specify which event source to use for this, in order
      to separate different instances. The server logging itself is still controlled
      by the regular logging parameters, including a separate setting for the event
      source. The parameter to pg_ctl only controlls the logging from pg_ctl itself.
      
      MauMau, review in many iterations by Amit Kapila and me.
      c0e4520b
    • Peter Eisentraut's avatar
      doc: Spell checking · aa688725
      Peter Eisentraut authored
      aa688725
  3. 16 Jul, 2014 2 commits
    • Heikki Linnakangas's avatar
      Fix bugs in SP-GiST search with range type's -|- (adjacent) operator. · 1264ef31
      Heikki Linnakangas authored
      The consistent function contained several bugs:
      
      * The "if (which2) { ... }"  block was broken. It compared the  argument's
      lower bound against centroid's upper bound, while it was supposed to compare
      the argument's upper bound against the centroid's lower bound (the comment
      was correct, code was wrong). Also, it cleared bits in the "which1"
      variable, while it was supposed to clear bits in "which2".
      
      * If the argument's upper bound was equal to the centroid's lower bound, we
      descended to both halves (= all quadrants). That's unnecessary, searching
      the right quadrants is sufficient. This didn't lead to incorrect query
      results, but was clearly wrong, and slowed down queries unnecessarily.
      
      * In the case that argument's lower bound is adjacent to the centroid's
      upper bound, we also don't need to visit all quadrants. Per similar
      reasoning as previous point.
      
      * The code where we compare the previous centroid with the current centroid
      should match the code where we compare the current centroid with the
      argument. The point of that code is to redo the calculation done in the
      previous level, to see if we were supposed to traverse left or right (or up
      or down), and if we actually did. If we moved in the different direction,
      then we know there are no matches for bound.
      
      Refactor the code and adds comments to make it more readable and easier to
      reason about.
      
      Backpatch to 9.3 where SP-GiST support for range types was introduced.
      1264ef31
    • Tom Lane's avatar
      Allow join removal in some cases involving a left join to a subquery. · f15821ee
      Tom Lane authored
      We can remove a left join to a relation if the relation's output is
      provably distinct for the columns involved in the join clause (considering
      only equijoin clauses) and the relation supplies no variables needed above
      the join.  Previously, the join removal logic could only prove distinctness
      by reference to unique indexes of a table.  This patch extends the logic
      to consider subquery relations, wherein distinctness might be proven by
      reference to GROUP BY, DISTINCT, etc.
      
      We actually already had some code to check that a subquery's output was
      provably distinct, but it was hidden inside pathnode.c; which was a pretty
      bad place for it really, since that file is mostly boilerplate Path
      construction and comparison.  Move that code to analyzejoins.c, which is
      arguably a more appropriate location, and is certainly the site of the
      new usage for it.
      
      David Rowley, reviewed by Simon Riggs
      f15821ee
  4. 15 Jul, 2014 14 commits
  5. 14 Jul, 2014 10 commits
  6. 12 Jul, 2014 4 commits
    • Magnus Hagander's avatar
      Support --with-extra-version equivalent functionality in MSVC build · 8d9a0e85
      Magnus Hagander authored
      Adds a configuration parameter, extraver, that is appended to the
      version number when built.
      
      Michael Paquier, reviewed by Muhammad Asif Naeem
      8d9a0e85
    • Andres Freund's avatar
      Minimal psql tab completion support for SET search_path. · bd409519
      Andres Freund authored
      Complete SET search_path = ... to non-temporary and non-toast
      schemas. Since there pretty much is no use case to add those to the
      search path and there can be many it's helpful to exclude them.
      
      It'd be nicer to complete multiple search path elements, but that's
      not easy.
      
      Jeff Janes
      bd409519
    • Andres Freund's avatar
      Fix decoding of consecutive MULTI_INSERTs emitted by one heap_multi_insert(). · 626bfad6
      Andres Freund authored
      Commit 1b86c81d fixed the decoding of toasted columns for the rows
      contained in one xl_heap_multi_insert record. But that's not actually
      enough, because heap_multi_insert() will actually first toast all
      passed in rows and then emit several *_multi_insert records; one for
      each page it fills with tuples.
      
      Add a XLOG_HEAP_LAST_MULTI_INSERT flag which is set in
      xl_heap_multi_insert->flag denoting that this multi_insert record is
      the last emitted by one heap_multi_insert() call. Then use that flag
      in decode.c to only set clear_toast_afterwards in the right situation.
      
      Expand the number of rows inserted via COPY in the corresponding
      regression test to make sure that more than one heap page is filled
      with tuples by one heap_multi_insert() call.
      
      Backpatch to 9.4 like the previous commit.
      626bfad6
    • Magnus Hagander's avatar
      Add autocompletion of locale keywords for CREATE DATABASE · deee42ab
      Magnus Hagander authored
      Adds support for autocomplete of LC_COLLATE and LC_CTYPE to
      the CREATE DATABASE command in psql.
      deee42ab
  7. 11 Jul, 2014 2 commits
    • Tom Lane's avatar
      Fix bug with whole-row references to append subplans. · d6858148
      Tom Lane authored
      ExecEvalWholeRowVar incorrectly supposed that it could "bless" the source
      TupleTableSlot just once per query.  But if the input is coming from an
      Append (or, perhaps, other cases?) more than one slot might be returned
      over the query run.  This led to "record type has not been registered"
      errors when a composite datum was extracted from a non-blessed slot.
      
      This bug has been there a long time; I guess it escaped notice because when
      dealing with subqueries the planner tends to expand whole-row Vars into
      RowExprs, which don't have the same problem.  It is possible to trigger
      the problem in all active branches, though, as illustrated by the added
      regression test.
      d6858148
    • Peter Eisentraut's avatar
      Fix whitespace · 80ddd04b
      Peter Eisentraut authored
      80ddd04b
  8. 10 Jul, 2014 3 commits
    • Tom Lane's avatar
      Implement IMPORT FOREIGN SCHEMA. · 59efda3e
      Tom Lane authored
      This command provides an automated way to create foreign table definitions
      that match remote tables, thereby reducing tedium and chances for error.
      In this patch, we provide the necessary core-server infrastructure and
      implement the feature fully in the postgres_fdw foreign-data wrapper.
      Other wrappers will throw a "feature not supported" error until/unless
      they are updated.
      
      Ronan Dunklau and Michael Paquier, additional work by me
      59efda3e
    • Bruce Momjian's avatar
      Adjust blank lines around PG_MODULE_MAGIC defines, for consistency · 6a605cd6
      Bruce Momjian authored
      Report by Robert Haas
      6a605cd6
    • Fujii Masao's avatar
      Add new ECHO mode 'errors' that displays only failed commands in psql. · 5b214c5d
      Fujii Masao authored
      When the psql variable ECHO is set to 'erros', only failed SQL commands
      are printed to standard error output. Also this patch adds -b option into psql.
      This is equivalent to setting the variable ECHO to 'errors'.
      
      Pavel Stehule, reviewed by Fabrízio de Royes Mello, Samrat Revagade,
      Kumar Rajeev Rastogi, Abhijit Menon-Sen, and me.
      5b214c5d
  9. 09 Jul, 2014 1 commit