1. 01 Dec, 2017 6 commits
  2. 30 Nov, 2017 7 commits
    • Robert Haas's avatar
      Remove extra word from comment. · 06ae669c
      Robert Haas authored
      David Rowley, who also was the primary author of the patch that
      added this function; the attribution in my previous commit,
      84940644, was incorrect due to
      sloppiness on my part.
      
      Discussion: http://postgr.es/m/CAKJS1f_0iSiLQsf_c06AzOWAc3eS6ePjjVQFpcFv3W-O5aktnQ@mail.gmail.com
      06ae669c
    • Peter Eisentraut's avatar
      SQL procedures · e4128ee7
      Peter Eisentraut authored
      This adds a new object type "procedure" that is similar to a function
      but does not have a return type and is invoked by the new CALL statement
      instead of SELECT or similar.  This implementation is aligned with the
      SQL standard and compatible with or similar to other SQL implementations.
      
      This commit adds new commands CALL, CREATE/ALTER/DROP PROCEDURE, as well
      as ALTER/DROP ROUTINE that can refer to either a function or a
      procedure (or an aggregate function, as an extension to SQL).  There is
      also support for procedures in various utility commands such as COMMENT
      and GRANT, as well as support in pg_dump and psql.  Support for defining
      procedures is available in all the languages supplied by the core
      distribution.
      
      While this commit is mainly syntax sugar around existing functionality,
      future features will rely on having procedures as a separate object
      type.
      Reviewed-by: default avatarAndrew Dunstan <andrew.dunstan@2ndquadrant.com>
      e4128ee7
    • Robert Haas's avatar
      Make create_unique_path manage memory like mark_dummy_rel. · 1761653b
      Robert Haas authored
      Put the unique path in the same context as the owning RelOptInfo, rather
      than the toplevel planner context.  This is how this function worked
      originally, but commit f41803bb
      changed it without explanation.  mark_dummy_rel adopted the older (or
      newer?) technique in commit eca75a12,
      which also featured a much better explanation of why it is correct.
      So, switch back to that technique here, with the same explanation
      given there.
      
      Although this fixes a possible memory leak when GEQO is in use, the
      leak is minor and probably nobody cares, so no back-patch.
      
      Ashutosh Bapat, reviewed by Tom Lane and by me
      
      Discussion: http://postgr.es/m/CAFjFpRcXkHHrXyD9BCvkgGJV4TnHG2SWJ0PhJfrDu3NAcQvh7g@mail.gmail.com
      1761653b
    • Noah Misch's avatar
      Fix non-GNU makefiles for AIX make. · e21a556e
      Noah Misch authored
      Invoking the Makefile without an explicit target was building every
      possible target instead of just the "all" target.  Back-patch to 9.3
      (all supported versions).
      e21a556e
    • Tom Lane's avatar
      Fix neqjoinsel's behavior for semi/anti join cases. · 7ca25b7d
      Tom Lane authored
      Previously, this function estimated the selectivity as 1 minus eqjoinsel()
      for the negator equality operator, regardless of join type (I think there
      was an expectation that eqjoinsel would handle the join type).  But
      actually this is completely wrong for semijoin cases: the fraction of the
      LHS that has a non-matching row is not one minus the fraction of the LHS
      that has a matching row.  In reality a semijoin with <> will nearly always
      succeed: it can only fail when the RHS is empty, or it contains a single
      distinct value that is equal to the particular LHS value, or the LHS value
      is null.  The only one of those things we should have much confidence in
      estimating is the fraction of LHS values that are null, so let's just take
      the selectivity as 1 minus outer nullfrac.
      
      Per coding convention, antijoin should be estimated the same as semijoin.
      
      Arguably this is a bug fix, but in view of the lack of field complaints
      and the risk of destabilizing plans, no back-patch.
      
      Thomas Munro, reviewed by Ashutosh Bapat
      
      Discussion: https://postgr.es/m/CAEepm=270ze2hVxWkJw-5eKzc3AB4C9KpH3L2kih75R5pdSogg@mail.gmail.com
      7ca25b7d
    • Andres Freund's avatar
      Add a barrier primitive for synchronizing backends. · 1145acc7
      Andres Freund authored
      Provide support for dynamic or static parties of processes to wait for
      all processes to reach point in the code before continuing.
      
      This is similar to the mechanism of the same name in POSIX threads and
      MPI, though has explicit phasing and dynamic party support like the
      Java core library's Phaser.
      
      This will be used by an upcoming patch adding support for parallel
      hash joins.
      
      Author: Thomas Munro
      Reviewed-By: Andres Freund
      Discussion: https://postgr.es/m/CAEepm=2_y7oi01OjA_wLvYcWMc9_d=LaoxrY3eiROCZkB_qakA@mail.gmail.com
      1145acc7
    • Andres Freund's avatar
      Add some regression tests that exercise hash join code. · fa330f9a
      Andres Freund authored
      Although hash joins are already tested by many queries, these tests
      systematically cover the four different states we can reach as part of
      the strategy for respecting work_mem.
      
      Author: Thomas Munro
      Reviewed-By: Andres Freund
      fa330f9a
  3. 29 Nov, 2017 8 commits
  4. 28 Nov, 2017 10 commits
  5. 27 Nov, 2017 4 commits
    • Tom Lane's avatar
      Fix creation of resjunk tlist entries for inherited mixed UPDATE/DELETE. · 9a785ad5
      Tom Lane authored
      rewriteTargetListUD's processing is dependent on the relkind of the query's
      target table.  That was fine at the time it was made to act that way, even
      for queries on inheritance trees, because all tables in an inheritance tree
      would necessarily be plain tables.  However, the 9.5 feature addition
      allowing some members of an inheritance tree to be foreign tables broke the
      assumption that rewriteTargetListUD's output tlist could be applied to all
      child tables with nothing more than column-number mapping.  This led to
      visible failures if foreign child tables had row-level triggers, and would
      also break in cases where child tables belonged to FDWs that used methods
      other than CTID for row identification.
      
      To fix, delay running rewriteTargetListUD until after the planner has
      expanded inheritance, so that it is applied separately to the (already
      mapped) tlist for each child table.  We can conveniently call it from
      preprocess_targetlist.  Refactor associated code slightly to avoid the
      need to heap_open the target relation multiple times during
      preprocess_targetlist.  (The APIs remain a bit ugly, particularly around
      the point of which steps scribble on parse->targetList and which don't.
      But avoiding such scribbling would require a change in FDW callback APIs,
      which is more pain than it's worth.)
      
      Also fix ExecModifyTable to ensure that "tupleid" is reset to NULL when
      we transition from rows providing a CTID to rows that don't.  (That's
      really an independent bug, but it manifests in much the same cases.)
      
      Add a regression test checking one manifestation of this problem, which
      was that row-level triggers on a foreign child table did not work right.
      
      Back-patch to 9.5 where the problem was introduced.
      
      Etsuro Fujita, reviewed by Ildus Kurbangaliev and Ashutosh Bapat
      
      Discussion: https://postgr.es/m/20170514150525.0346ba72@postgrespro.ru
      9a785ad5
    • Simon Riggs's avatar
      11746900
    • Simon Riggs's avatar
      Pad XLogReaderState's per-buffer data_bufsz more aggressively. · 59af8d43
      Simon Riggs authored
      Originally, we palloc'd this buffer just barely big enough to hold the
      largest xlog backup block seen so far. We now MAXALIGN the palloc size.
      
      The original coding could result in many repeated palloc cycles, in the
      worst case where we see a series ofgradually larger xlog records.  We
      ameliorate that similarly to 8735978e
      by imposing a minimum buffer size of BLCKSZ.
      
      Discussion: https://postgr.es/m/E1eHa4J-0006hI-Q8@gemulon.postgresql.org
      59af8d43
    • Magnus Hagander's avatar
      Fix typo in comment · d5f965c2
      Magnus Hagander authored
      Andreas Karlsson
      d5f965c2
  6. 26 Nov, 2017 2 commits
    • Tom Lane's avatar
      Pad XLogReaderState's main_data buffer more aggressively. · 8735978e
      Tom Lane authored
      Originally, we palloc'd this buffer just barely big enough to hold the
      largest xlog record seen so far.  It turns out that that can result in
      valgrind complaints, because some compilers will emit code that assumes
      it can safely fetch padding bytes at the end of a struct, and those
      padding bytes were unallocated so far as aset.c was concerned.  We can
      fix that by MAXALIGN'ing the palloc request size, ensuring that it is big
      enough to include any possible padding that might've been omitted from
      the on-disk record.
      
      An additional objection to the original coding is that it could result in
      many repeated palloc cycles, in the worst case where we see a series of
      gradually larger xlog records.  We can ameliorate that cheaply by
      imposing a minimum buffer size that's large enough for most xlog records.
      BLCKSZ/2 was chosen after a bit of discussion.
      
      In passing, remove an obsolete comment in struct xl_heap_new_cid that the
      combocid field is free due to alignment considerations.  Perhaps that was
      true at some point, but it's not now.
      
      Back-patch to 9.5 where this code came in.
      
      Discussion: https://postgr.es/m/E1eHa4J-0006hI-Q8@gemulon.postgresql.org
      8735978e
    • Joe Conway's avatar
      Make has_sequence_privilege support WITH GRANT OPTION · 752714dd
      Joe Conway authored
      The various has_*_privilege() functions all support an optional
      WITH GRANT OPTION added to the supported privilege types to test
      whether the privilege is held with grant option. That is, all except
      has_sequence_privilege() variations. Fix that.
      
      Back-patch to all supported branches.
      
      Discussion: https://postgr.es/m/005147f6-8280-42e9-5a03-dd2c1e4397ef@joeconway.com
      752714dd
  7. 25 Nov, 2017 3 commits