Skip to content
Snippets Groups Projects
  1. Apr 18, 2014
    • Peter Eisentraut's avatar
      Create function prototype as part of PG_FUNCTION_INFO_V1 macro · e7128e8d
      Peter Eisentraut authored
      Because of gcc -Wmissing-prototypes, all functions in dynamically
      loadable modules must have a separate prototype declaration.  This is
      meant to detect global functions that are not declared in header files,
      but in cases where the function is called via dfmgr, this is redundant.
      Besides filling up space with boilerplate, this is a frequent source of
      compiler warnings in extension modules.
      
      We can fix that by creating the function prototype as part of the
      PG_FUNCTION_INFO_V1 macro, which such modules have to use anyway.  That
      makes the code of modules cleaner, because there is one less place where
      the entry points have to be listed, and creates an additional check that
      functions have the right prototype.
      
      Remove now redundant prototypes from contrib and other modules.
      e7128e8d
  2. Apr 17, 2014
  3. Apr 16, 2014
    • Tom Lane's avatar
      Fix contrib/postgres_fdw's remote-estimate representation of array Params. · 5b68d816
      Tom Lane authored
      We were emitting "(SELECT null::typename)", which is usually interpreted
      as a scalar subselect, but not so much in the context "x = ANY(...)".
      This led to remote-side parsing failures when remote_estimate is enabled.
      A quick and ugly fix is to stick in an extra cast step,
      "((SELECT null::typename)::typename)".  The cast will be thrown away as
      redundant by parse analysis, but not before it's done its job of making
      sure the grammar sees the ANY argument as an a_expr rather than a
      select_with_parens.  Per an example from Hannu Krosing.
      5b68d816
    • Bruce Momjian's avatar
      pg_upgrade: remove redundant include files · 95cb9172
      Bruce Momjian authored
      The files were already included by pg_upgrade.h.
      95cb9172
  4. Apr 15, 2014
  5. Apr 13, 2014
  6. 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
  7. 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
  8. Apr 02, 2014
  9. Apr 01, 2014
  10. Mar 31, 2014
  11. Mar 30, 2014
  12. 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
  13. Mar 27, 2014
  14. Mar 26, 2014
  15. 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
  16. Mar 21, 2014
  17. Mar 20, 2014
  18. Mar 18, 2014
  19. 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
  20. Mar 12, 2014
  21. 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
  22. Mar 05, 2014
  23. 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
Loading