1. 23 Jan, 2017 9 commits
  2. 22 Jan, 2017 3 commits
    • Tom Lane's avatar
      Relocate static function declarations to be after typedefs in jsonfuncs.c. · 90992e0e
      Tom Lane authored
      Project style is to put things in this order, for the good and sufficient
      reason that you often need the typedefs in the function declarations.
      There already was one function declaration that needed a typedef, which
      was randomly placed away from all the other static function declarations
      in consequence.  And the submitted patch for better json_populate_record
      functionality jumped through even more hoops in order to preserve this
      bad idea.
      
      This patch only moves lines from point A to point B, no other changes.
      90992e0e
    • Tom Lane's avatar
      Remove no-longer-needed loop in ExecGather(). · 0a8b9d3b
      Tom Lane authored
      Coverity complained quite properly that commit ea15e186 had introduced
      unreachable code into ExecGather(); to wit, it was no longer possible to
      iterate the final for-loop more or less than once.  So remove the for().
      
      In passing, clean up a couple of comments, and make better use of a local
      variable.
      0a8b9d3b
    • Peter Eisentraut's avatar
      Add missing break · 8f164e1e
      Peter Eisentraut authored
      8f164e1e
  3. 21 Jan, 2017 3 commits
    • Peter Eisentraut's avatar
      b4800867
    • Tom Lane's avatar
      Fix cross-shlib linking in temporary installs on HPUX 10. · d2ab1176
      Tom Lane authored
      Turns out this has been broken for years and we'd not noticed.  The one
      case that was getting exercised in the buildfarm, or probably anywhere
      else, was postgres_fdw.sl's reference to libpq.sl; and it turns out that
      that was always going to libpq.sl in the actual installation directory
      not the temporary install.  We'd not noticed because the buildfarm script
      does "make install" before it tests contrib.  However, the recent addition
      of a logical-replication test to the core regression scripts resulted in
      trying to use libpqwalreceiver.sl before "make install" happens, and that
      failed for lack of finding libpq.sl, as shown by failures on buildfarm
      members gaur and pademelon.
      
      There are two changes needed to fix it: the magic environment variable to
      specify shlib search path at runtime is SHLIB_PATH not LD_LIBRARY_PATH,
      and the shlib link command needs to specify the +s switch else the library
      will not honor SHLIB_PATH.
      
      I'm not quite sure why buildfarm members anole and gharial (HPUX 11) didn't
      show the same failure.  Consulting man pages on the web says that HPUX 11
      honors both LD_LIBRARY_PATH and SHLIB_PATH, which would explain half of it,
      and the rather confusing wording I've been able to find suggests that +s
      might effectively be the default in HPUX 11.  But it seems at least as
      likely that there's just a libpq.so installed in /usr/lib on that machine;
      as long as it's not too ancient, that would satisfy the test.  In any case
      I do not think this patch will break HPUX 11.
      
      At the moment I don't see a need to back-patch this, since it only matters
      for testing purposes, not to mention that HPUX 10 is probably dead in the
      real world anyway.
      d2ab1176
    • Peter Eisentraut's avatar
      Move some things from builtins.h to new header files · f21a563d
      Peter Eisentraut authored
      This avoids that builtins.h has to include additional header files.
      f21a563d
  4. 20 Jan, 2017 11 commits
  5. 19 Jan, 2017 13 commits
    • Tom Lane's avatar
      Fix Assert failure induced by commit 215b43cd. · d479e37e
      Tom Lane authored
      I'd somehow talked myself into believing that set_append_rel_size
      doesn't need to worry about getting back an AND clause when it applies
      eval_const_expressions to the result of adjust_appendrel_attrs (that is,
      transposing the appendrel parent's restriction clauses for one child).
      But that is nonsense, and Andreas Seltenreich's fuzz tester soon
      turned up a counterexample.  Put back the make_ands_implicit step
      that was there before, and add a regression test covering the case.
      
      Report: https://postgr.es/m/878tq6vja6.fsf@ansel.ydns.eu
      d479e37e
    • Andres Freund's avatar
      Fix platform dependant regression output triggered by 69f4b9c8. · 18220053
      Andres Freund authored
      Due to the changed costing in that commit hash-aggregates started to
      be used, which results in big-endian vs. little-endian output
      differences.  Disable hash-aggs for those tests.
      
      Author: Andres Freund, with input from Tom Lane
      Discussion: https://postgr.es/m/22891.1484791792@sss.pgh.pa.us
      18220053
    • Andres Freund's avatar
      Remove obsoleted code relating to targetlist SRF evaluation. · ea15e186
      Andres Freund authored
      Since 69f4b9c8 plain expression evaluation (and thus normal projection)
      can't return sets of tuples anymore. Thus remove code dealing with
      that possibility.
      
      This will require adjustments in external code using
      ExecEvalExpr()/ExecProject() - that should neither be hard nor very
      common.
      
      Author: Andres Freund and Tom Lane
      Discussion: https://postgr.es/m/20160822214023.aaxz5l4igypowyri@alap3.anarazel.de
      ea15e186
    • Alvaro Herrera's avatar
      Fix race condition in reading commit timestamps · 8eace46d
      Alvaro Herrera authored
      If a user requests the commit timestamp for a transaction old enough
      that its data is concurrently being truncated away by vacuum at just the
      right time, they would receive an ugly internal file-not-found error
      message from slru.c rather than the expected NULL return value.
      
      In a primary server, the window for the race is very small: the lookup
      has to occur exactly between the two calls by vacuum, and there's not a
      lot that happens between them (mostly just a multixact truncate).  In a
      standby server, however, the window is larger because the truncation is
      executed as soon as the WAL record for it is replayed, but the advance
      of the oldest-Xid is not executed until the next checkpoint record.
      
      To fix in the primary, simply reverse the order of operations in
      vac_truncate_clog.  To fix in the standby, augment the WAL truncation
      record so that the standby is aware of the new oldest-XID value and can
      apply the update immediately.  WAL version bumped because of this.
      
      No backpatch, because of the low importance of the bug and its rarity.
      
      Author: Craig Ringer
      Reviewed-By: Petr Jelínek, Peter Eisentraut
      Discussion: https://postgr.es/m/CAMsr+YFhVtRQT1VAwC+WGbbxZZRzNou=N9Ed-FrCqkwQ8H8oJQ@mail.gmail.com
      8eace46d
    • Peter Eisentraut's avatar
      initdb: Fix for mixed-case superuser names · 8b0fec93
      Peter Eisentraut authored
      The previous coding did not properly quote the user name before casting
      it to regrole.  To avoid all that, just pass in BOOTSTRAP_SUPERUSERID
      numerically.
      
      Also fix one place where the BOOTSTRAP_SUPERUSERID was hardcoded as 10.
      8b0fec93
    • Robert Haas's avatar
      Teach partitioning tests not to use DROP TABLE ... CASCADE. · c3978149
      Robert Haas authored
      This occasionally causes failures; the order in which the affected
      objects are listed is not 100% consistent.
      
      Amit Langote
      c3978149
    • Robert Haas's avatar
      Avoid some code duplication in map_partition_varattnos(). · cc144155
      Robert Haas authored
      Code to map attribute numbers in map_partition_varattnos() duplicates
      what convert_tuples_by_name_map() does.  Avoid that.
      
      Amit Langote, per a report from Álvaro Herrera.
      
      Discussion: http://postgr.es/m/9ce97382-54c8-deb3-9ee9-a2ec271d866b%40lab.ntt.co.jp
      cc144155
    • Robert Haas's avatar
      Fix some problems in check_new_partition_bound(). · 8a8afe2f
      Robert Haas authored
      Account for the fact that the highest bound less than or equal to the
      upper bound might be either the lower or the upper bound of the
      overlapping partition, depending on whether the proposed partition
      completely contains the existing partition or merely overlaps it.
      
      Also, we need not continue searching for even greater bound in
      partition_bound_bsearch() once we find the first bound that is *equal*
      to the probe, because we don't have duplicate datums.  That spends
      cycles needlessly.
      
      Amit Langote, per a report from Amul Sul.  Cosmetic changes by me.
      
      Discussion: http://postgr.es/m/CAAJ_b94XgbqVoXMyxxs63CaqWoMS1o2gpHiU0F7yGnJBnvDc_A%40mail.gmail.com
      8a8afe2f
    • Robert Haas's avatar
      Fix RETURNING to work correctly with partition tuple routing. · 05bd8899
      Robert Haas authored
      In ExecInsert(), do not switch back to the root partitioned table
      ResultRelInfo until after we finish ExecProcessReturning(), so that
      RETURNING projection is done using the partition's descriptor.  For
      the projection to work correctly, we must initialize the same for each
      leaf partition during ModifyTableState initialization.
      
      Amit Langote
      05bd8899
    • Robert Haas's avatar
      Fix failure to enforce partitioning contraint for internal partitions. · 39162b20
      Robert Haas authored
      When a tuple is inherited into a partitioning root, no partition
      constraints need to be enforced; when it is inserted into a leaf, the
      parent's partitioning quals needed to be enforced.  The previous
      coding got both of those cases right.  When a tuple is inserted into
      an intermediate level of the partitioning hierarchy (i.e. a table
      which is both a partition itself and in turn partitioned), it must
      enforce the partitioning qual inherited from its parent.  That case
      got overlooked; repair.
      
      Amit Langote
      39162b20
    • Stephen Frost's avatar
      Dump sequence data based on the TableDataInfo flag · bec96c82
      Stephen Frost authored
      When considering a sequence's Data entry in dumpSequenceData, we were
      actually looking at the sequence definition's dump flag to decide if we
      should dump the data or not.  That's generally fine, except for when the
      sequence data entry was created by processExtensionTables() because it's
      a config sequence.  In that case, the sequence itself won't be marked as
      dumping data because it's part of an extension, leading to the need for
      processExtensionTables() to create the sequence data entry.
      
      This leads to extension config sequence data not being included in the
      dump when it should be.  Fix this by looking at the sequence data's dump
      flag instead, just as dumpTableData() was doing for tables (which is why
      config tables were correctly being handled), and add a regression test
      to make sure we don't break it moving forward.
      
      All of this is a bit round-about since we can now represent which
      components of a given dump item should be dumped out through the dump
      flag.  A future improvement might be to change checkExtensionMembership()
      to check for config sequences/tables and set the dump flag based on that
      directly, possibly removing the need for processExtensionTables().
      
      Bug found by Daniele Varrazzo.
      
      Discussion: https://postgr.es/m/CA+mi_8ZmxQM7+nZ7pJ8uyfxc9V3o=UAG14dVqvftdmvw8OJ3gQ@mail.gmail.com
      
      Patch by Michael Paquier, with some tweaking of the regression tests by
      me.
      
      Back-patch to 9.6 where the bug was introduced.
      bec96c82
    • Alvaro Herrera's avatar
      Allow negative years in make_date to represent BC years · 30bcebbd
      Alvaro Herrera authored
      There doesn't seem to be any reason not to allow negative years to be
      interpreted as BC, so do that.
      
      The documentation is pretty vague on the details of this function, so
      nothing needs to change there.
      
      Reported-by: Andy Abelisto, in bug #14446
      30bcebbd
    • Andres Freund's avatar
      Adapt python regression tests to 69f4b9c8. · 8b07aee8
      Andres Freund authored
      Hopefully this'll unbreak the buildfarm.
      8b07aee8
  6. 18 Jan, 2017 1 commit
    • Tom Lane's avatar
      Doc: improve documentation of new SRF-in-tlist behavior. · f13a1277
      Tom Lane authored
      Correct a misstatement about how things used to work: we did allow nested
      SRFs before, as long as no function had more than one set-returning input.
      
      Also, attempt to document the fact that the new implementation changes the
      behavior for SRFs within conditional constructs (eg CASE): the conditional
      construct no longer gates whether the SRF is run, and thus cannot affect
      the number of rows emitted.  We might want to change this behavior, but
      first it behooves us to see if we can explain it.
      
      Minor other wordsmithing on what I wrote yesterday, too.
      
      Discussion: https://postgr.es/m/20170118214702.54b2mdbxce5piwv5@alap3.anarazel.de
      f13a1277