Skip to content
Snippets Groups Projects
  1. Apr 13, 2014
  2. Apr 06, 2014
    • Tom Lane's avatar
      Improve contrib/pg_trgm's heuristics for regexp index searches. · 80a5cf64
      Tom Lane authored
      When extracting trigrams from a regular expression for search of a GIN or
      GIST trigram index, it's useful to penalize (preferentially discard)
      trigrams that contain whitespace, since those are typically far more common
      in the index than trigrams not containing whitespace.  Of course, this
      should only be a preference not a hard rule, since we might otherwise end
      up with no trigrams to search for.  The previous coding tended to produce
      fairly inefficient trigram search sets for anchored regexp patterns, as
      reported by Erik Rijkers.  This patch penalizes whitespace-containing
      trigrams, and also reduces the target number of extracted trigrams, since
      experience suggests that the original coding tended to select too many
      trigrams to search for.
      
      Alexander Korotkov, reviewed by Tom Lane
      80a5cf64
  3. Apr 04, 2014
    • Tom Lane's avatar
      Fix non-equivalence of VARIADIC and non-VARIADIC function call formats. · c7b35395
      Tom Lane authored
      For variadic functions (other than VARIADIC ANY), the syntaxes foo(x,y,...)
      and foo(VARIADIC ARRAY[x,y,...]) should be considered equivalent, since the
      former is converted to the latter at parse time.  They have indeed been
      equivalent, in all releases before 9.3.  However, commit 75b39e79 made an
      ill-considered decision to record which syntax had been used in FuncExpr
      nodes, and then to make equal() test that in checking node equality ---
      which caused the syntaxes to not be seen as equivalent by the planner.
      This is the underlying cause of bug #9817 from Dmitry Ryabov.
      
      It might seem that a quick fix would be to make equal() disregard
      FuncExpr.funcvariadic, but the same commit made that untenable, because
      the field actually *is* semantically significant for some VARIADIC ANY
      functions.  This patch instead adopts the approach of redefining
      funcvariadic (and aggvariadic, in HEAD) as meaning that the last argument
      is a variadic array, whether it got that way by parser intervention or was
      supplied explicitly by the user.  Therefore the value will always be true
      for non-ANY variadic functions, restoring the principle of equivalence.
      (However, the planner will continue to consider use of VARIADIC as a
      meaningful difference for VARIADIC ANY functions, even though some such
      functions might disregard it.)
      
      In HEAD, this change lets us simplify the decompilation logic in
      ruleutils.c, since the funcvariadic/aggvariadic flag tells directly whether
      to print VARIADIC.  However, in 9.3 we have to continue to cope with
      existing stored rules/views that might contain the previous definition.
      Fortunately, this just means no change in ruleutils.c, since its existing
      behavior effectively ignores funcvariadic for all cases other than VARIADIC
      ANY functions.
      
      In HEAD, bump catversion to reflect the fact that FuncExpr.funcvariadic
      changed meanings; this is sort of pro forma, since I don't believe any
      built-in views are affected.
      
      Unfortunately, this patch doesn't magically fix everything for affected
      9.3 users.  After installing 9.3.5, they might need to recreate their
      rules/views/indexes containing variadic function calls in order to get
      everything consistent with the new definition.  As in the cited bug,
      the symptom of a problem would be failure to use a nominally matching
      index that has a variadic function call in its definition.  We'll need
      to mention this in the 9.3.5 release notes.
      c7b35395
  4. Apr 02, 2014
  5. Apr 01, 2014
  6. Mar 31, 2014
  7. Mar 30, 2014
  8. Mar 29, 2014
    • Noah Misch's avatar
      Revert "Secure Unix-domain sockets of "make check" temporary clusters." · 8f5578d0
      Noah Misch authored
      About half of the buildfarm members use too-long directory names,
      strongly suggesting that this approach is a dead end.
      8f5578d0
    • Noah Misch's avatar
      Secure Unix-domain sockets of "make check" temporary clusters. · 31c6e54e
      Noah Misch authored
      Any OS user able to access the socket can connect as the bootstrap
      superuser and in turn execute arbitrary code as the OS user running the
      test.  Protect against that by placing the socket in the temporary data
      directory, which has mode 0700 thanks to initdb.  Back-patch to 8.4 (all
      supported versions).  The hazard remains wherever the temporary cluster
      accepts TCP connections, notably on Windows.
      
      Attempts to run "make check" from a directory with a long name will now
      fail.  An alternative not sharing that problem was to place the socket
      in a subdirectory of /tmp, but that is only secure if /tmp is sticky.
      The PG_REGRESS_SOCK_DIR environment variable is available as a
      workaround when testing from long directory paths.
      
      As a convenient side effect, this lets testing proceed smoothly in
      builds that override DEFAULT_PGSOCKET_DIR.  Popular non-default values
      like /var/run/postgresql are often unwritable to the build user.
      
      Security: CVE-2014-0067
      31c6e54e
    • Noah Misch's avatar
  9. Mar 27, 2014
  10. Mar 26, 2014
  11. Mar 23, 2014
    • Andrew Dunstan's avatar
      Introduce jsonb, a structured format for storing json. · d9134d0a
      Andrew Dunstan authored
      The new format accepts exactly the same data as the json type. However, it is
      stored in a format that does not require reparsing the orgiginal text in order
      to process it, making it much more suitable for indexing and other operations.
      Insignificant whitespace is discarded, and the order of object keys is not
      preserved. Neither are duplicate object keys kept - the later value for a given
      key is the only one stored.
      
      The new type has all the functions and operators that the json type has,
      with the exception of the json generation functions (to_json, json_agg etc.)
      and with identical semantics. In addition, there are operator classes for
      hash and btree indexing, and two classes for GIN indexing, that have no
      equivalent in the json type.
      
      This feature grew out of previous work by Oleg Bartunov and Teodor Sigaev, which
      was intended to provide similar facilities to a nested hstore type, but which
      in the end proved to have some significant compatibility issues.
      
      Authors: Oleg Bartunov,  Teodor Sigaev, Peter Geoghegan and Andrew Dunstan.
      Review: Andres Freund
      d9134d0a
    • Noah Misch's avatar
      Don't test xmin/xmax columns of a postgres_fdw foreign table. · b2b2491b
      Noah Misch authored
      Their values are unspecified and system-dependent.
      
      Per buildfarm member kouprey.
      b2b2491b
    • Noah Misch's avatar
      Offer triggers on foreign tables. · 7cbe57c3
      Noah Misch authored
      This covers all the SQL-standard trigger types supported for regular
      tables; it does not cover constraint triggers.  The approach for
      acquiring the old row mirrors that for view INSTEAD OF triggers.  For
      AFTER ROW triggers, we spool the foreign tuples to a tuplestore.
      
      This changes the FDW API contract; when deciding which columns to
      populate in the slot returned from data modification callbacks, writable
      FDWs will need to check for AFTER ROW triggers in addition to checking
      for a RETURNING clause.
      
      In support of the feature addition, refactor the TriggerFlags bits and
      the assembly of old tuples in ModifyTable.
      
      Ronan Dunklau, reviewed by KaiGai Kohei; some additional hacking by me.
      7cbe57c3
  12. Mar 21, 2014
  13. Mar 20, 2014
  14. Mar 18, 2014
  15. Mar 17, 2014
    • Fujii Masao's avatar
      Fix typos in comments. · 2bccced1
      Fujii Masao authored
      Thom Brown
      2bccced1
    • Tom Lane's avatar
      Fix unportable shell-script syntax in pg_upgrade's test.sh. · 0268d21e
      Tom Lane authored
      I discovered the hard way that on some old shells, the locution
          FOO=""   unset FOO
      does not behave the same as
          FOO="";  unset FOO
      and in fact leaves FOO set to an empty string.  test.sh was inconsistently
      spelling it different ways on adjacent lines.
      
      This got broken relatively recently, in commit c737a2e5, so the lack of
      field reports to date doesn't represent a lot of evidence that the problem
      is rare.
      0268d21e
  16. Mar 12, 2014
  17. Mar 07, 2014
    • Tom Lane's avatar
      Remove unportable use of anonymous unions from reorderbuffer.h. · ea177a3b
      Tom Lane authored
      In b89e1510 I had assumed it was ok to use anonymous unions as
      struct members, but while a longstanding extension in many compilers,
      it's only been standardized in C11.
      
      To fix, remove one of the anonymous unions which tried to hide some
      implementation specific enum values and give the other a name. The
      latter unfortunately requires changes in output plugins, but since the
      feature has only been added a few days ago...
      
      Andres Freund
      ea177a3b
    • Tom Lane's avatar
      Fix contrib/postgres_fdw to handle multiple join conditions properly. · 83204e10
      Tom Lane authored
      The previous coding supposed that it could consider just a single join
      condition in any one parameterized path for the foreign table.  But in
      reality, the parameterized-path machinery forces all join clauses that are
      "movable to" the foreign table to be evaluated at that node; including
      clauses that we might not consider safe to send across.  Such cases would
      result in an Assert failure in an assert-enabled build, and otherwise in
      sending an unsafe clause to the foreign server, which might result in
      errors or silently-wrong answers.  A lesser problem was that the
      cost/rowcount estimates generated for the parameterized path failed to
      account for any additional join quals that get assigned to the scan.
      
      To fix, rewrite postgresGetForeignPaths so that it correctly collects all
      the movable quals for any one outer relation when generating parameterized
      paths; we'll now generate just one path per outer relation not one per join
      qual.  Also fix bogus assumptions in postgresGetForeignPlan and
      estimate_path_cost_size that only safe-to-send join quals will be
      presented.
      
      Based on complaint from Etsuro Fujita that the path costs were being
      miscalculated, though this is significantly different from his proposed
      patch.
      83204e10
  18. Mar 05, 2014
  19. Mar 04, 2014
    • Andrew Dunstan's avatar
      Provide a FORCE NULL option to COPY in CSV mode. · 3b5e03dc
      Andrew Dunstan authored
      This forces an input field containing the quoted null string to be
      returned as a NULL. Without this option, only unquoted null strings
      behave this way. This helps where some CSV producers insist on quoting
      every field, whether or not it is needed. The option takes a list of
      fields, and only applies to those columns. There is an equivalent
      column-level option added to file_fdw.
      
      Ian Barwick, with some tweaking by Andrew Dunstan, reviewed by Payal
      Singh.
      3b5e03dc
    • Alvaro Herrera's avatar
      auto_explain: Add logging of trigger execution · e2a0fc53
      Alvaro Herrera authored
      Author: Kyotaro HORIGUCHI
      Reviewed-by: Jaime Casanova
      e2a0fc53
  20. Mar 03, 2014
    • Robert Haas's avatar
      Introduce logical decoding. · b89e1510
      Robert Haas authored
      This feature, building on previous commits, allows the write-ahead log
      stream to be decoded into a series of logical changes; that is,
      inserts, updates, and deletes and the transactions which contain them.
      It is capable of handling decoding even across changes to the schema
      of the effected tables.  The output format is controlled by a
      so-called "output plugin"; an example is included.  To make use of
      this in a real replication system, the output plugin will need to be
      modified to produce output in the format appropriate to that system,
      and to perform filtering.
      
      Currently, information can be extracted from the logical decoding
      system only via SQL; future commits will add the ability to stream
      changes via walsender.
      
      Andres Freund, with review and other contributions from many other
      people, including Álvaro Herrera, Abhijit Menon-Sen, Peter Gheogegan,
      Kevin Grittner, Robert Haas, Heikki Linnakangas, Fujii Masao, Abhijit
      Menon-Sen, Michael Paquier, Simon Riggs, Craig Ringer, and Steve
      Singer.
      b89e1510
    • Robert Haas's avatar
      pageinspect: Use new pg_lsn datatype. · 45ffeb7e
      Robert Haas authored
      Michael Paquier, with slight comment changes by me
      45ffeb7e
  21. Feb 28, 2014
  22. Feb 27, 2014
    • Tom Lane's avatar
      Remove dependency on database encoding in citext regression test. · 1161d895
      Tom Lane authored
      Testing convert_to(..., 'ISO-8859-1') fails if there isn't a conversion
      function available from the database encoding to ISO-8859-1.  This has
      been broken since day one, but the breakage was hidden by
      pg_do_encoding_conversion's failure to complain, up till commit
      49c817ea.
      
      Since the data being converted in this test is plain ASCII, no actual
      conversion need happen (and if it did, it would prove little about citext
      anyway).  So that we still have some code coverage of the convert() family
      of functions, let's switch to using convert_from, with SQL_ASCII as the
      specified source encoding.  Per buildfarm.
      1161d895
  23. Feb 23, 2014
    • Tom Lane's avatar
      Prefer pg_any_to_server/pg_server_to_any over pg_do_encoding_conversion. · 769065c1
      Tom Lane authored
      A large majority of the callers of pg_do_encoding_conversion were
      specifying the database encoding as either source or target of the
      conversion, meaning that we can use the less general functions
      pg_any_to_server/pg_server_to_any instead.
      
      The main advantage of using the latter functions is that they can make use
      of a cached conversion-function lookup in the common case that the other
      encoding is the current client_encoding.  It's notationally cleaner too in
      most cases, not least because of the historical artifact that the latter
      functions use "char *" rather than "unsigned char *" in their APIs.
      
      Note that pg_any_to_server will apply an encoding verification step in
      some cases where pg_do_encoding_conversion would have just done nothing.
      This seems to me to be a good idea at most of these call sites, though
      it partially negates the performance benefit.
      
      Per discussion of bug #9210.
      769065c1
  24. Feb 21, 2014
    • Heikki Linnakangas's avatar
      Avoid integer overflow in hstore_to_json(). · 0c5783ff
      Heikki Linnakangas authored
      The length of the output buffer was calculated based on the size of the
      argument hstore. On a sizeof(int) == 4 platform and a huge argument, it
      could overflow, causing a too small buffer to be allocated.
      
      Refactor the function to use a StringInfo instead of pre-allocating the
      buffer. Makes it shorter and more readable, too.
      0c5783ff
Loading