1. 10 Jun, 2018 5 commits
    • Tom Lane's avatar
      Relocate partition pruning structs to a saner place. · 939449de
      Tom Lane authored
      These struct definitions were originally dropped into primnodes.h,
      which is a poor choice since that's mainly intended for primitive
      expression node types; these are not in that category.  What they
      are is auxiliary info in Plan trees, so move them to plannodes.h.
      
      For consistency, also relocate some related code that was apparently
      placed with the aid of a dartboard.
      
      There's no interesting code changes in this commit, just reshuffling.
      
      David Rowley and Tom Lane
      
      Discussion: https://postgr.es/m/CAFj8pRBjrufA3ocDm8o4LPGNye9Y+pm1b9kCwode4X04CULG3g@mail.gmail.com
      939449de
    • Tom Lane's avatar
      Improve run-time partition pruning to handle any stable expression. · 73b7f48f
      Tom Lane authored
      The initial coding of the run-time-pruning feature only coped with cases
      where the partition key(s) are compared to Params.  That is a bit silly;
      we can allow it to work with any non-Var-containing stable expression, as
      long as we take special care with expressions containing PARAM_EXEC Params.
      The code is hardly any longer this way, and it's considerably clearer
      (IMO at least).  Per gripe from Pavel Stehule.
      
      David Rowley, whacked around a bit by me
      
      Discussion: https://postgr.es/m/CAFj8pRBjrufA3ocDm8o4LPGNye9Y+pm1b9kCwode4X04CULG3g@mail.gmail.com
      73b7f48f
    • Michael Paquier's avatar
      Fix grammar in REVOKE documentation · c83e2029
      Michael Paquier authored
      Reported-by: Erwin Brandstetter
      c83e2029
    • Michael Paquier's avatar
      Fix and document lock handling for in-memory replication slot data · 9e149c84
      Michael Paquier authored
      While debugging issues on HEAD for the new slot forwarding feature of
      Postgres 11, some monitoring of the code surrounding in-memory slot data
      has proved that the lock handling may cause inconsistent data to be read
      by read-only callers of slot functions, particularly
      pg_get_replication_slots() which fetches data for the system view
      pg_replication_slots, or modules looking directly at slot information.
      
      The code paths involved in those problems concern logical decoding
      initialization (down to 9.4) and WAL reservation for slots (new as of
      10).
      
      A set of comments documenting all the lock handlings, particularly the
      dependency with LW locks for slots and the in_use flag as well as the
      internal mutex lock is added, based on a suggested by Simon Riggs.
      
      Some of the fixed code exists down to 9.4 where WAL decoding has been
      introduced, but as those race conditions are really unlikely going to
      happen as those concern code paths for slot and decoding creation, just
      fix the problem on HEAD.
      
      Author: Michael Paquier
      
      Discussion: https://postgr.es/m/20180528085747.GA27845@paquier.xyz
      9e149c84
    • Thomas Munro's avatar
      Limit Parallel Hash's bucket array to MaxAllocSize. · 86a2218e
      Thomas Munro authored
      Make sure that we don't exceed MaxAllocSize when increasing the number of
      buckets.  Perhaps later we'll remove that limit and use DSA_ALLOC_HUGE, but
      for now just prevent further increases like the non-parallel code.  This
      change avoids the error from bug report #15225.
      
      Author: Thomas Munro
      Reviewed-By: Tom Lane
      Reported-by: Frits Jalvingh
      Discussion: https://postgr.es/m/152802081668.26724.16985037679312485972%40wrigleys.postgresql.org
      86a2218e
  2. 09 Jun, 2018 1 commit
  3. 08 Jun, 2018 5 commits
  4. 07 Jun, 2018 3 commits
  5. 06 Jun, 2018 1 commit
    • Alvaro Herrera's avatar
      Fix function code in error report · eee381ef
      Alvaro Herrera authored
      This bug causes a lseek() failure to be reported as a "could not open"
      failure in the error message, muddling bug reports.  I introduced this
      copy-and-pasteo in commit 78e12201.
      
      Noticed while reviewing code for bug report #15221, from lily liang.  In
      version 10 the affected function is only used by multixact.c and
      commit_ts, and only in corner-case circumstances, neither of which are
      involved in the reported bug (a pg_subtrans failure.)
      
      Author: Álvaro Herrera
      eee381ef
  6. 04 Jun, 2018 3 commits
  7. 01 Jun, 2018 1 commit
  8. 31 May, 2018 2 commits
    • Noah Misch's avatar
      Reconcile nodes/*funcs.c with PostgreSQL 11 work. · ef310950
      Noah Misch authored
      This covers new fields in two outfuncs.c functions having no readfuncs.c
      counterpart.  Thus, this changes only debugging output.
      ef310950
    • Andrew Dunstan's avatar
      Fix compile-time warnings on all perl code · 0039049f
      Andrew Dunstan authored
      This patch does two things. First, it silences a number of compile-time
      warnings in the msvc tools files, mainly those due to the fact that in
      some cases we have more than one package per file. Second it supplies a
      dummy Perl library with just enough of the Windows API referred to in
      our code to let it run these checks cleanly, even on Unix machines where
      the code is never supposed to run. The dummy library should only be used
      for that purpose, as its README notes.
      0039049f
  9. 30 May, 2018 2 commits
  10. 29 May, 2018 1 commit
    • Peter Eisentraut's avatar
      Initialize new jsonb iterator to zero · 3c9cf069
      Peter Eisentraut authored
      Use palloc0() instead of palloc() to create a new JsonbIterator.
      Otherwise, the isScalar field is sometimes not initialized.  There is
      probably no impact in practice, but it's cleaner this way and it avoids
      future problems.
      3c9cf069
  11. 28 May, 2018 3 commits
  12. 27 May, 2018 3 commits
  13. 26 May, 2018 1 commit
  14. 25 May, 2018 2 commits
    • Tom Lane's avatar
      Fix misidentification of SQL statement type in plpgsql's exec_stmt_execsql. · 9a8aa25c
      Tom Lane authored
      To distinguish SQL statements that are INSERT/UPDATE/DELETE from other
      ones, exec_stmt_execsql looked at the post-rewrite form of the statement
      rather than the original.  This is problematic because it did that only
      during first execution of the statement (in a session), but the correct
      answer could change later due to addition or removal of DO INSTEAD rules
      during the session.  That could lead to an Assert failure, as reported
      by Tushar Ahuja and Robert Haas.  In non-assert builds, there's a hazard
      that we would fail to enforce STRICT behavior when we'd be expected to.
      That would happen if an initially present DO INSTEAD, that replaced the
      original statement with one of a different type, were removed; after that
      the statement should act "normally", including strictness enforcement, but
      it didn't.  (The converse case of enforcing strictness when we shouldn't
      doesn't seem to be a hazard, as addition of a DO INSTEAD that changes the
      statement type would always lead to acting as though the statement returned
      zero rows, so that the strictness error could not fire.)
      
      To fix, inspect the original form of the statement not the post-rewrite
      form, making it valid to assume the answer can't change intra-session.
      This should lead to the same answer in every case except when there is a
      DO INSTEAD that changes the statement type; we will now set mod_stmt=true
      anyway, while we would not have done so before.  That breaks the Assert
      in the SPI_OK_REWRITTEN code path, which expected the latter behavior.
      It might be all right to assert mod_stmt rather than !mod_stmt there,
      but I'm not entirely convinced that that'd always hold, so just remove
      the assertion altogether.
      
      This has been broken for a long time, so back-patch to all supported
      branches.
      
      Discussion: https://postgr.es/m/CA+TgmoZUrRN4xvZe_BbBn_Xp0BDwuMEue-0OyF0fJpfvU2Yc7Q@mail.gmail.com
      9a8aa25c
    • Magnus Hagander's avatar
      Remove incorrect statement about IPC configuration on OpenBSD · 7019c21c
      Magnus Hagander authored
      kern.ipc.shm_use_phys is not a sysctl on OpenBSD, and SEMMAP is not
      a kernel configuration option. These were probably copy pasteos from
      when the documentation had a single paragraph for *BSD.
      
      Author: Daniel Gustafsson <daniel@yesql.se>
      7019c21c
  15. 24 May, 2018 7 commits