Skip to content
Snippets Groups Projects
  1. Aug 10, 2015
    • Andres Freund's avatar
      Add confirmed_flush column to pg_replication_slots. · 3f811c2d
      Andres Freund authored
      There's no reason not to expose both restart_lsn and confirmed_flush
      since they have rather distinct meanings. The former is the oldest WAL
      still required and valid for both physical and logical slots, whereas
      the latter is the location up to which a logical slot's consumer has
      confirmed receiving data. Most of the time a slot will require older
      WAL (i.e. restart_lsn) than the confirmed
      position (i.e. confirmed_flush_lsn).
      
      Author: Marko Tiikkaja, editorialized by me
      Discussion: 559D110B.1020109@joh.to
      3f811c2d
  2. Aug 03, 2015
    • Tom Lane's avatar
      contrib/isn now needs a .gitignore file. · fd7ed26c
      Tom Lane authored
      Oversight in commit cb3384a0.
      Back-patch to 9.1, like that commit.
      fd7ed26c
    • Tom Lane's avatar
      Fix a number of places that produced XX000 errors in the regression tests. · 09cecdf2
      Tom Lane authored
      It's against project policy to use elog() for user-facing errors, or to
      omit an errcode() selection for errors that aren't supposed to be "can't
      happen" cases.  Fix all the violations of this policy that result in
      ERRCODE_INTERNAL_ERROR log entries during the standard regression tests,
      as errors that can reliably be triggered from SQL surely should be
      considered user-facing.
      
      I also looked through all the files touched by this commit and fixed
      other nearby problems of the same ilk.  I do not claim to have fixed
      all violations of the policy, just the ones in these files.
      
      In a few places I also changed existing ERRCODE choices that didn't
      seem particularly appropriate; mainly replacing ERRCODE_SYNTAX_ERROR
      by something more specific.
      
      Back-patch to 9.5, but no further; changing ERRCODE assignments in
      stable branches doesn't seem like a good idea.
      09cecdf2
  3. Aug 02, 2015
    • Heikki Linnakangas's avatar
      Fix output of ISBN-13 numbers beginning with 979. · cb3384a0
      Heikki Linnakangas authored
      An EAN beginning with 979 (but not 9790 - those are ISMN's) are accepted
      as ISBN numbers, but they cannot be represented in the old, 10-digit ISBN
      format. They must be output in the new 13-digit ISBN-13 format. We printed
      out an incorrect value for those.
      
      Also add a regression test, to test this and some other basic functionality
      of the module.
      
      Patch by Fabien Coelho. This fixes bug #13442, reported by B.Z. Backpatch
      to 9.1, where we started to recognize ISBN-13 numbers.
      cb3384a0
  4. Jul 25, 2015
    • Tom Lane's avatar
      Some platforms now need contrib/tsm_system_time to be linked with libm. · c879d51c
      Tom Lane authored
      Buildfarm member hornet, at least, seems to want -lm in the link command.
      Probably this is due to the just-added use of isnan().
      c879d51c
    • Tom Lane's avatar
      Redesign tablesample method API, and do extensive code review. · dd7a8f66
      Tom Lane authored
      The original implementation of TABLESAMPLE modeled the tablesample method
      API on index access methods, which wasn't a good choice because, without
      specialized DDL commands, there's no way to build an extension that can
      implement a TSM.  (Raw inserts into system catalogs are not an acceptable
      thing to do, because we can't undo them during DROP EXTENSION, nor will
      pg_upgrade behave sanely.)  Instead adopt an API more like procedural
      language handlers or foreign data wrappers, wherein the only SQL-level
      support object needed is a single handler function identified by having
      a special return type.  This lets us get rid of the supporting catalog
      altogether, so that no custom DDL support is needed for the feature.
      
      Adjust the API so that it can support non-constant tablesample arguments
      (the original coding assumed we could evaluate the argument expressions at
      ExecInitSampleScan time, which is undesirable even if it weren't outright
      unsafe), and discourage sampling methods from looking at invisible tuples.
      Make sure that the BERNOULLI and SYSTEM methods are genuinely repeatable
      within and across queries, as required by the SQL standard, and deal more
      honestly with methods that can't support that requirement.
      
      Make a full code-review pass over the tablesample additions, and fix
      assorted bugs, omissions, infelicities, and cosmetic issues (such as
      failure to put the added code stanzas in a consistent ordering).
      Improve EXPLAIN's output of tablesample plans, too.
      
      Back-patch to 9.5 so that we don't have to support the original API
      in production.
      dd7a8f66
  5. Jul 21, 2015
  6. Jul 20, 2015
  7. Jul 18, 2015
  8. Jul 16, 2015
    • Noah Misch's avatar
      AIX: Link TRANSFORM modules with their dependencies. · 71934367
      Noah Misch authored
      The result closely resembles linking of these modules for the "win32"
      port.  Augment the $(exports_file) header so the file is also usable as
      an import file.  Unfortunately, relocating an AIX installation will now
      require adding $(pkglibdir) to LD_LIBRARY_PATH.  Back-patch to 9.5,
      where the modules were introduced.
      71934367
    • Noah Misch's avatar
      MinGW: Link ltree_plpython with plpython. · 736c1f23
      Noah Misch authored
      The MSVC build system already did this, and building against Python 3
      requires it.  Back-patch to 9.5, where the module was introduced.
      736c1f23
  9. Jul 14, 2015
  10. Jul 09, 2015
  11. Jul 02, 2015
  12. Jun 27, 2015
    • Andres Freund's avatar
      Fix test_decoding's handling of nonexistant columns in old tuple versions. · d47a1136
      Andres Freund authored
      test_decoding used fastgetattr() to extract column values. That's wrong
      when decoding updates and deletes if a table's replica identity is set
      to FULL and new columns have been added since the old version of the
      tuple was created. Due to the lack of a crosscheck with the datum's
      natts values an invalid value will be output, leading to errors or
      worse.
      
      Bug: #13470
      Reported-By: Krzysztof Kotlarski
      Discussion: 20150626100333.3874.90852@wrigleys.postgresql.org
      
      Backpatch to 9.4, where the feature, including the bug, was added.
      d47a1136
  13. May 31, 2015
    • Peter Eisentraut's avatar
      Make Python tests more portable · 75f9d176
      Peter Eisentraut authored
      Newer Python versions randomize the hash seed for dictionaries,
      resulting in a random output order, which messes up the regression test
      diffs.
      
      Instead, use Python assert to compare the dictionaries with their
      expected value.
      75f9d176
  14. May 28, 2015
  15. May 24, 2015
    • Tom Lane's avatar
      Manual cleanup of pgindent results. · 2aa0476d
      Tom Lane authored
      Fix some places where pgindent did silly stuff, often because project
      style wasn't followed to begin with.  (I've not touched the atomics
      headers, though.)
      2aa0476d
    • Tom Lane's avatar
      Remove no-longer-required function declarations. · 91e79260
      Tom Lane authored
      Remove a bunch of "extern Datum foo(PG_FUNCTION_ARGS);" declarations that
      are no longer needed now that PG_FUNCTION_INFO_V1(foo) provides that.
      
      Some of these were evidently missed in commit e7128e8d, but others
      were cargo-culted in in code added since then.  Possibly that can be blamed
      in part on the fact that we'd not fixed relevant documentation examples,
      which I've now done.
      91e79260
    • Bruce Momjian's avatar
      pgindent run for 9.5 · 807b9e0d
      Bruce Momjian authored
      807b9e0d
  16. May 20, 2015
    • Heikki Linnakangas's avatar
      Collection of typo fixes. · 4fc72cc7
      Heikki Linnakangas authored
      Use "a" and "an" correctly, mostly in comments. Two error messages were
      also fixed (they were just elogs, so no translation work required). Two
      function comments in pg_proc.h were also fixed. Etsuro Fujita reported one
      of these, but I found a lot more with grep.
      
      Also fix a few other typos spotted while grepping for the a/an typos.
      For example, "consists out of ..." -> "consists of ...". Plus a "though"/
      "through" mixup reported by Euler Taveira.
      
      Many of these typos were in old code, which would be nice to backpatch to
      make future backpatching easier. But much of the code was new, and I didn't
      feel like crafting separate patches for each branch. So no backpatching.
      4fc72cc7
  17. May 19, 2015
    • Andres Freund's avatar
      Refactor ON CONFLICT index inference parse tree representation. · 0740cbd7
      Andres Freund authored
      Defer lookup of opfamily and input type of a of a user specified opclass
      until the optimizer selects among available unique indexes; and store
      the opclass in the parse analyzed tree instead.  The primary reason for
      doing this is that for rule deparsing it's easier to use the opclass
      than the previous representation.
      
      While at it also rename a variable in the inference code to better fit
      it's purpose.
      
      This is separate from the actual fixes for deparsing to make review
      easier.
      0740cbd7
    • Peter Eisentraut's avatar
      Fix parse tree of DROP TRANSFORM and COMMENT ON TRANSFORM · 0779f2ba
      Peter Eisentraut authored
      The plain C string language name needs to be wrapped in makeString() so
      that the parse tree is copyable.  This is detectable by
      -DCOPY_PARSE_PLAN_TREES.  Add a test case for the COMMENT case.
      
      Also make the quoting in the error messages more consistent.
      
      discovered by Tom Lane
      0779f2ba
  18. May 18, 2015
    • Noah Misch's avatar
      pgcrypto: Report errant decryption as "Wrong key or corrupt data". · 85270ac7
      Noah Misch authored
      This has been the predominant outcome.  When the output of decrypting
      with a wrong key coincidentally resembled an OpenPGP packet header,
      pgcrypto could instead report "Corrupt data", "Not text data" or
      "Unsupported compression algorithm".  The distinct "Corrupt data"
      message added no value.  The latter two error messages misled when the
      decrypted payload also exhibited fundamental integrity problems.  Worse,
      error message variance in other systems has enabled cryptologic attacks;
      see RFC 4880 section "14. Security Considerations".  Whether these
      pgcrypto behaviors are likewise exploitable is unknown.
      
      In passing, document that pgcrypto does not resist side-channel attacks.
      Back-patch to 9.0 (all supported versions).
      
      Security: CVE-2015-3167
      85270ac7
    • Tom Lane's avatar
      Use += not = to set makefile variables after including base makefiles. · b14cf229
      Tom Lane authored
      The previous coding in hstore_plpython and ltree_plpython wiped out any
      values set by the base makefiles.  This at least had the effect of running
      the tests in "regression" not "contrib_regression" as expected.  These
      being pretty new modules, there might be other bad effects we'd not
      noticed yet.
      b14cf229
  19. May 17, 2015
  20. May 16, 2015
    • Andres Freund's avatar
      Support GROUPING SETS, CUBE and ROLLUP. · f3d31185
      Andres Freund authored
      This SQL standard functionality allows to aggregate data by different
      GROUP BY clauses at once. Each grouping set returns rows with columns
      grouped by in other sets set to NULL.
      
      This could previously be achieved by doing each grouping as a separate
      query, conjoined by UNION ALLs. Besides being considerably more concise,
      grouping sets will in many cases be faster, requiring only one scan over
      the underlying data.
      
      The current implementation of grouping sets only supports using sorting
      for input. Individual sets that share a sort order are computed in one
      pass. If there are sets that don't share a sort order, additional sort &
      aggregation steps are performed. These additional passes are sourced by
      the previous sort step; thus avoiding repeated scans of the source data.
      
      The code is structured in a way that adding support for purely using
      hash aggregation or a mix of hashing and sorting is possible. Sorting
      was chosen to be supported first, as it is the most generic method of
      implementation.
      
      Instead of, as in an earlier versions of the patch, representing the
      chain of sort and aggregation steps as full blown planner and executor
      nodes, all but the first sort are performed inside the aggregation node
      itself. This avoids the need to do some unusual gymnastics to handle
      having to return aggregated and non-aggregated tuples from underlying
      nodes, as well as having to shut down underlying nodes early to limit
      memory usage.  The optimizer still builds Sort/Agg node to describe each
      phase, but they're not part of the plan tree, but instead additional
      data for the aggregation node. They're a convenient and preexisting way
      to describe aggregation and sorting.  The first (and possibly only) sort
      step is still performed as a separate execution step. That retains
      similarity with existing group by plans, makes rescans fairly simple,
      avoids very deep plans (leading to slow explains) and easily allows to
      avoid the sorting step if the underlying data is sorted by other means.
      
      A somewhat ugly side of this patch is having to deal with a grammar
      ambiguity between the new CUBE keyword and the cube extension/functions
      named cube (and rollup). To avoid breaking existing deployments of the
      cube extension it has not been renamed, neither has cube been made a
      reserved keyword. Instead precedence hacking is used to make GROUP BY
      cube(..) refer to the CUBE grouping sets feature, and not the function
      cube(). To actually group by a function cube(), unlikely as that might
      be, the function name has to be quoted.
      
      Needs a catversion bump because stored rules may change.
      
      Author: Andrew Gierth and Atri Sharma, with contributions from Andres Freund
      Reviewed-By: Andres Freund, Noah Misch, Tom Lane, Svenne Krap, Tomas
          Vondra, Erik Rijkers, Marti Raudsepp, Pavel Stehule
      Discussion: CAOeZVidmVRe2jU6aMk_5qkxnB7dfmPROzM7Ur8JPW5j8Y5X-Lw@mail.gmail.com
      f3d31185
  21. May 15, 2015
    • Alvaro Herrera's avatar
      Move strategy numbers to include/access/stratnum.h · 26df7066
      Alvaro Herrera authored
      For upcoming BRIN opclasses, it's convenient to have strategy numbers
      defined in a single place.  Since there's nothing appropriate, create
      it.  The StrategyNumber typedef now lives there, as well as existing
      strategy numbers for B-trees (from skey.h) and R-tree-and-friends (from
      gist.h).  skey.h is forced to include stratnum.h because of the
      StrategyNumber typedef, but gist.h is not; extensions that currently
      rely on gist.h for rtree strategy numbers might need to add a new
      
      A few .c files can stop including skey.h and/or gist.h, which is a nice
      side benefit.
      
      Per discussion:
      https://www.postgresql.org/message-id/20150514232132.GZ2523@alvh.no-ip.org
      
      Authored by Emre Hasegeli and Álvaro.
      
      (It's not clear to me why bootscanner.l has any #include lines at all.)
      26df7066
    • Simon Riggs's avatar
      Add to contrib/Makefile · df259759
      Simon Riggs authored
      df259759
    • Simon Riggs's avatar
      contrib/tsm_system_time · 56e121a5
      Simon Riggs authored
      56e121a5
    • Simon Riggs's avatar
      contrib/tsm_system_rows · 4d40494b
      Simon Riggs authored
      4d40494b
    • Simon Riggs's avatar
      TABLESAMPLE, SQL Standard and extensible · f6d208d6
      Simon Riggs authored
      Add a TABLESAMPLE clause to SELECT statements that allows
      user to specify random BERNOULLI sampling or block level
      SYSTEM sampling. Implementation allows for extensible
      sampling functions to be written, using a standard API.
      Basic version follows SQLStandard exactly. Usable
      concrete use cases for the sampling API follow in later
      commits.
      
      Petr Jelinek
      
      Reviewed by Michael Paquier and Simon Riggs
      f6d208d6
    • Stephen Frost's avatar
      Remove useless pg_audit.conf · aff27e33
      Stephen Frost authored
      No need to have pg_audit.conf any longer since the regression tests are
      just loading the module at the start of each session (to simulate being
      in shared_preload_libraries, which isn't something we can actually make
      happen on the buildfarm itself, it seems).
      
      Pointed out by Tom
      aff27e33
    • Simon Riggs's avatar
      Separate block sampling functions · 83e176ec
      Simon Riggs authored
      Refactoring ahead of tablesample patch
      
      Requested and reviewed by Michael Paquier
      
      Petr Jelinek
      83e176ec
Loading