Skip to content
Snippets Groups Projects
  1. Dec 27, 2015
  2. Dec 25, 2015
  3. Dec 22, 2015
    • Robert Haas's avatar
      postgres_fdw: Consider requesting sorted data so we can do a merge join. · ccd8f979
      Robert Haas authored
      When use_remote_estimate is enabled, consider adding ORDER BY to the
      query we sending to the remote server so that we can use that ordered
      data for a merge join.  Commit f18c944b
      arranges to push down the query pathkeys, which seems like the case
      mostly likely to be a win, but testing shows this can sometimes win,
      too.
      
      For a regular table, we know which indexes are present and therefore
      test whether the ordering provided by each such index is useful.  Here,
      we take the opposite approach: guess what orderings would be useful if
      they could be generated cheaply, and then ask the remote side what those
      will cost.
      
      Ashutosh Bapat, with very substantial cosmetic revisions by me.  Also
      reviewed by Rushabh Lathia.
      ccd8f979
  4. Dec 19, 2015
  5. Dec 18, 2015
    • Teodor Sigaev's avatar
      Cube extension kNN support · 33bd250f
      Teodor Sigaev authored
      Introduce distance operators over cubes:
      <#> taxicab distance
      <->  euclidean distance
      <=> chebyshev distance
      
      Also add kNN support of those distances in GiST opclass.
      
      Author: Stas Kelvich
      33bd250f
  6. Dec 08, 2015
    • Robert Haas's avatar
      Allow foreign and custom joins to handle EvalPlanQual rechecks. · 385f337c
      Robert Haas authored
      Commit e7cb7ee1 provided basic
      infrastructure for allowing a foreign data wrapper or custom scan
      provider to replace a join of one or more tables with a scan.
      However, this infrastructure failed to take into account the need
      for possible EvalPlanQual rechecks, and ExecScanFetch would fail
      an assertion (or just overwrite memory) if such a check was attempted
      for a plan containing a pushed-down join.  To fix, adjust the EPQ
      machinery to skip some processing steps when scanrelid == 0, making
      those the responsibility of scan's recheck method, which also has
      the responsibility in this case of correctly populating the relevant
      slot.
      
      To allow foreign scans to gain control in the right place to make
      use of this new facility, add a new, optional RecheckForeignScan
      method.  Also, allow a foreign scan to have a child plan, which can
      be used to correctly populate the slot (or perhaps for something
      else, but this is the only use currently envisioned).
      
      KaiGai Kohei, reviewed by Robert Haas, Etsuro Fujita, and Kyotaro
      Horiguchi.
      385f337c
  7. Nov 25, 2015
  8. Nov 19, 2015
    • Tom Lane's avatar
      Dodge a macro-name conflict with Perl. · 68c1d7d4
      Tom Lane authored
      Some versions of Perl export a macro named HS_KEY.  This creates a
      conflict in contrib/hstore_plperl against hstore's macro of the same
      name.  The most future-proof solution seems to be to rename our macro;
      I chose HSTORE_KEY.  For consistency, rename HS_VAL and related macros
      similarly.
      
      Back-patch to 9.5.  contrib/hstore_plperl doesn't exist before that
      so there is no need to worry about the conflict in older releases.
      
      Per reports from Marco Atzeri and Mike Blackwell.
      68c1d7d4
  9. Nov 18, 2015
  10. Nov 04, 2015
    • Tom Lane's avatar
      Add regression tests for remote execution of extension operators/functions. · b9f117d6
      Tom Lane authored
      Rather than relying on other extensions to be available for installation,
      let's just add some test objects to the postgres_fdw extension itself
      within the regression script.
      b9f117d6
    • Tom Lane's avatar
      Allow postgres_fdw to ship extension funcs/operators for remote execution. · d8949416
      Tom Lane authored
      The user can whitelist specified extension(s) in the foreign server's
      options, whereupon we will treat immutable functions and operators of those
      extensions as candidates to be sent for remote execution.
      
      Whitelisting an extension in this way basically promises that the extension
      exists on the remote server and behaves compatibly with the local instance.
      We have no way to prove that formally, so we have to rely on the user to
      get it right.  But this seems like something that people can usually get
      right in practice.
      
      We might in future allow functions and operators to be whitelisted
      individually, but extension granularity is a very convenient special case,
      so it got done first.
      
      The patch as-committed lacks any regression tests, which is unfortunate,
      but introducing dependencies on other extensions for testing purposes
      would break "make installcheck" scenarios, which is worse.  I have some
      ideas about klugy ways around that, but it seems like material for a
      separate patch.  For the moment, leave the problem open.
      
      Paul Ramsey, hacked up a bit more by me
      d8949416
  11. Nov 03, 2015
    • Robert Haas's avatar
      postgres_fdw: Add ORDER BY to some remote SQL queries. · f18c944b
      Robert Haas authored
      If the join problem's entire ORDER BY clause can be pushed to the
      remote server, consider a path that adds this ORDER BY clause.  If
      use_remote_estimate is on, we cost this path using an additional
      remote EXPLAIN.  If not, we just estimate that the path costs 20%
      more, which is intended to be large enough that we won't request a
      remote sort when it's not helpful, but small enough that we'll have
      the remote side do the sort when in doubt.  In some cases, the remote
      sort might actually be free, because the remote query plan might
      happen to produce output that is ordered the way we need, but without
      remote estimates we have no way of knowing that.
      
      It might also be useful to request sorted output from the remote side
      if it enables an efficient merge join, but this patch doesn't attempt
      to handle that case.
      
      Ashutosh Bapat with revisions by me.  Also reviewed by Fabrízio de Royes
      Mello and Jeevan Chalke.
      f18c944b
  12. Oct 29, 2015
  13. Oct 15, 2015
    • Robert Haas's avatar
      Allow FDWs to push down quals without breaking EvalPlanQual rechecks. · 5fc4c26d
      Robert Haas authored
      This fixes a long-standing bug which was discovered while investigating
      the interaction between the new join pushdown code and the EvalPlanQual
      machinery: if a ForeignScan appears on the inner side of a paramaterized
      nestloop, an EPQ recheck would re-return the original tuple even if
      it no longer satisfied the pushed-down quals due to changed parameter
      values.
      
      This fix adds a new member to ForeignScan and ForeignScanState and a
      new argument to make_foreignscan, and requires changes to FDWs which
      push down quals to populate that new argument with a list of quals they
      have chosen to push down.  Therefore, I'm only back-patching to 9.5,
      even though the bug is not new in 9.5.
      
      Etsuro Fujita, reviewed by me and by Kyotaro Horiguchi.
      5fc4c26d
  14. Oct 12, 2015
  15. Oct 05, 2015
    • Noah Misch's avatar
      Prevent stack overflow in query-type functions. · 5976097c
      Noah Misch authored
      The tsquery, ltxtquery and query_int data types have a common ancestor.
      Having acquired check_stack_depth() calls independently, each was
      missing at least one call.  Back-patch to 9.0 (all supported versions).
      5976097c
    • Noah Misch's avatar
      pgcrypto: Detect and report too-short crypt() salts. · 1d812c8b
      Noah Misch authored
      Certain short salts crashed the backend or disclosed a few bytes of
      backend memory.  For existing salt-induced error conditions, emit a
      message saying as much.  Back-patch to 9.0 (all supported versions).
      
      Josh Kupershmidt
      
      Security: CVE-2015-5288
      1d812c8b
  16. Oct 04, 2015
    • Tom Lane's avatar
      Improve contrib/pg_stat_statements' handling of garbage collection failure. · 8bbe4cbd
      Tom Lane authored
      If we can't read the query texts file (whether because out-of-memory, or
      for some other reason), give up and reset the file to empty, discarding all
      stored query texts, though not the statistics per se.  We used to leave
      things alone and hope for better luck next time, but the problem is that
      the file is only going to get bigger and even harder to slurp into memory.
      Better to do something that will get us out of trouble.
      
      Likewise reset the file to empty for any other failure within gc_qtexts().
      The previous behavior after a write error was to discard query texts but
      not do anything to truncate the file, which is just weird.
      
      Also, increase the maximum supported file size from MaxAllocSize to
      MaxAllocHugeSize; this makes it more likely we'll be able to do a garbage
      collection successfully.
      
      Also, fix recalculation of mean_query_len within entry_dealloc() to match
      the calculation in gc_qtexts().  The previous coding overlooked the
      possibility of dropped texts (query_len == -1) and would underestimate the
      mean of the remaining entries in such cases, thus possibly causing excess
      garbage collection cycles.
      
      In passing, add some errdetail to the log entry that complains about
      insufficient memory to read the query texts file, which after all was
      Jim Nasby's original complaint.
      
      Back-patch to 9.4 where the current handling of query texts was
      introduced.
      
      Peter Geoghegan, rather editorialized upon by me
      8bbe4cbd
  17. Oct 03, 2015
    • Andres Freund's avatar
    • Andres Freund's avatar
      Add CASCADE support for CREATE EXTENSION. · b67aaf21
      Andres Freund authored
      Without CASCADE, if an extension has an unfullfilled dependency on
      another extension, CREATE EXTENSION ERRORs out with "required extension
      ... is not installed". That is annoying, especially when that dependency
      is an implementation detail of the extension, rather than something the
      extension's user can make sense of.
      
      In addition to CASCADE this also includes a small set of regression
      tests around CREATE EXTENSION.
      
      Author: Petr Jelinek, editorialized by Michael Paquier, Andres Freund
      Reviewed-By: Michael Paquier, Andres Freund, Jeff Janes
      Discussion: 557E0520.3040800@2ndquadrant.com
      b67aaf21
    • Andres Freund's avatar
      Improve errhint() about replication slot naming restrictions. · 920218cb
      Andres Freund authored
      The existing hint talked about "may only contain letters", but the
      actual requirement is more strict: only lower case letters are allowed.
      
      Reported-By: Rushabh Lathia
      Author: Rushabh Lathia
      Discussion: AGPqQf2x50qcwbYOBKzb4x75sO_V3g81ZsA8+Ji9iN5t_khFhQ@mail.gmail.com
      Backpatch: 9.4-, where replication slots were added
      920218cb
  18. Sep 24, 2015
    • Tom Lane's avatar
      Improve handling of collations in contrib/postgres_fdw. · 76f965ff
      Tom Lane authored
      If we have a local Var of say varchar type with default collation, and
      we apply a RelabelType to convert that to text with default collation, we
      don't want to consider that as creating an FDW_COLLATE_UNSAFE situation.
      It should be okay to compare that to a remote Var, so long as the remote
      Var determines the comparison collation.  (When we actually ship such an
      expression to the remote side, the local Var would become a Param with
      default collation, meaning the remote Var would in fact control the
      comparison collation, because non-default implicit collation overrides
      default implicit collation in parse_collate.c.)  To fix, be more precise
      about what FDW_COLLATE_NONE means: it applies either to a noncollatable
      data type or to a collatable type with default collation, if that collation
      can't be traced to a remote Var.  (When it can, FDW_COLLATE_SAFE is
      appropriate.)  We were essentially using that interpretation already at
      the Var/Const/Param level, but we weren't bubbling it up properly.
      
      An alternative fix would be to introduce a separate FDW_COLLATE_DEFAULT
      value to describe the second situation, but that would add more code
      without changing the actual behavior, so it didn't seem worthwhile.
      
      Also, since we're clarifying the rule to be that we care about whether
      operator/function input collations match, there seems no need to fail
      immediately upon seeing a Const/Param/non-foreign-Var with nondefault
      collation.  We only have to reject if it appears in a collation-sensitive
      context (for example, "var IS NOT NULL" is perfectly safe from a collation
      standpoint, whatever collation the var has).  So just set the state to
      UNSAFE rather than failing immediately.
      
      Per report from Jeevan Chalke.  This essentially corrects some sloppy
      thinking in commit ed3ddf91, so back-patch
      to 9.3 where that logic appeared.
      76f965ff
  19. Sep 22, 2015
    • Andres Freund's avatar
      test_decoding: Protect against rare spurious test failures. · eef34e52
      Andres Freund authored
      A bunch of tests missed specifying that empty transactions shouldn't be
      displayed. That causes problems when e.g. autovacuum runs in an
      unfortunate moment. The tests in question only run for a very short
      time, making this quite unlikely.
      
      Reported-By: Buildfarm member axolotl
      Backpatch: 9.4, where logical decoding was introduced
      eef34e52
  20. Sep 08, 2015
    • Alvaro Herrera's avatar
    • Alvaro Herrera's avatar
      contrib/sslinfo: add ssl_extension_info SRF · 49124613
      Alvaro Herrera authored
      This new function provides information about SSL extensions present in
      the X509 certificate used for the current connection.
      
      Extension version updated to version 1.1.
      
      Author: Дмитрий Воронин (Dmitry Voronin)
      Reviewed by: Michael Paquier, Heikki Linnakangas, Álvaro Herrera
      49124613
    • Alvaro Herrera's avatar
      Add more sanity checks in contrib/sslinfo · d94c36a4
      Alvaro Herrera authored
      We were missing a few return checks on OpenSSL calls.  Should be pretty
      harmless, since we haven't seen any user reports about problems, and
      this is not a high-traffic module anyway; still, a bug is a bug, so
      backpatch this all the way back to 9.0.
      
      Author: Michael Paquier, while reviewing another sslinfo patch
      d94c36a4
  21. Sep 06, 2015
  22. Sep 05, 2015
    • Tom Lane's avatar
      Rearrange the handling of error context reports. · 0426f349
      Tom Lane authored
      Remove the code in plpgsql that suppressed the innermost line of CONTEXT
      for messages emitted by RAISE commands.  That was never more than a quick
      backwards-compatibility hack, and it's pretty silly in cases where the
      RAISE is nested in several levels of function.  What's more, it violated
      our design theory that verbosity of error reports should be controlled
      on the client side not the server side.
      
      To alleviate the resulting noise increase, introduce a feature in libpq
      and psql whereby the CONTEXT field of messages can be suppressed, either
      always or only for non-error messages.  Printing CONTEXT for errors only
      is now their default behavior.
      
      The actual code changes here are pretty small, but the effects on the
      regression test outputs are widespread.  I had to edit some of the
      alternative expected outputs by hand; hopefully the buildfarm will soon
      find anything I fat-fingered.
      
      In passing, fix up (again) the output line counts in psql's various
      help displays.  Add some commentary about how to verify them.
      
      Pavel Stehule, reviewed by Petr Jelínek, Jeevan Chalke, and others
      0426f349
    • Heikki Linnakangas's avatar
      Fix misc typos. · c80b5f66
      Heikki Linnakangas authored
      Oskari Saarenmaa. Backpatch to stable branches where applicable.
      c80b5f66
  23. Sep 04, 2015
  24. Aug 30, 2015
    • Joe Conway's avatar
      Fix sepgsql regression tests. · 794e2558
      Joe Conway authored
      The regression tests for sepgsql were broken by changes in the
      base distro as-shipped policies. Specifically, definition of
      unconfined_t in the system default policy was changed to bypass
      multi-category rules, which the regression test depended on.
      Fix that by defining a custom privileged domain
      (sepgsql_regtest_superuser_t) and using it instead of system's
      unconfined_t domain. The new sepgsql_regtest_superuser_t domain
      performs almost like the current unconfined_t, but restricted by
      multi-category policy as the traditional unconfined_t was.
      
      The custom policy module is a self defined domain, and so should not
      be affected by related future system policy changes. However, it still
      uses the unconfined_u:unconfined_r pair for selinux-user and role.
      Those definitions have not been changed for several years and seem
      less risky to rely on than the unconfined_t domain. Additionally, if
      we define custom user/role, they would need to be manually defined
      at the operating system level, adding more complexity to an already
      non-standard and complex regression test.
      
      Back-patch to 9.3. The regression tests will need more work before
      working correctly on 9.2. Starting with 9.2, sepgsql has had dependencies
      on libselinux versions that are only available on newer distros with
      the changed set of policies (e.g. RHEL 7.x). On 9.1 sepgsql works
      fine with the older distros with original policy set (e.g. RHEL 6.x),
      and on which the existing regression tests work fine. We might want
      eventually change 9.1 sepgsql regression tests to be more independent
      from the underlying OS policies, however more work will be needed to
      make that happen and it is not clear that it is worth the effort.
      
      Kohei KaiGai with review by Adam Brightwell and me, commentary by
      Stephen, Alvaro, Tom, Robert, and others.
      794e2558
  25. Aug 23, 2015
  26. Aug 15, 2015
  27. Aug 13, 2015
    • Alvaro Herrera's avatar
      Use materialize SRF mode in brin_page_items · 94d626ff
      Alvaro Herrera authored
      This function was using the single-value-per-call mechanism, but the
      code relied on a relcache entry that wasn't kept open across calls.
      This manifested as weird errors in buildfarm during the short time that
      the "brin-1" isolation test lived.
      
      Backpatch to 9.5, where it was introduced.
      94d626ff
  28. 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
  29. 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
  30. 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
Loading