1. 26 Mar, 2018 7 commits
  2. 25 Mar, 2018 11 commits
  3. 24 Mar, 2018 3 commits
    • Peter Eisentraut's avatar
      initdb: Improve --wal-segsize handling · 496d5667
      Peter Eisentraut authored
      Give separate error messages for when the argument is not a number and
      when it is not the right kind of number.
      
      Fix wording in the help message.
      496d5667
    • Peter Eisentraut's avatar
      Improve pg_resetwal documentation · 4644a117
      Peter Eisentraut authored
      Clarify that the -l option takes a file name, not an "address", and that
      that might be different from the LSN if nondefault WAL segment sizes are
      used.
      4644a117
    • Noah Misch's avatar
      Don't qualify type pg_catalog.text in extend-extensions-example. · c92f7c62
      Noah Misch authored
      Extension scripts begin execution with pg_catalog at the front of the
      search path, so type names reliably refer to pg_catalog.  Remove these
      superfluous qualifications.  Earlier <programlisting> of this <sect1>
      already omitted them.  Back-patch to 9.3 (all supported versions).
      c92f7c62
  4. 23 Mar, 2018 12 commits
    • Peter Eisentraut's avatar
      Small refactoring · 52f3a9d6
      Peter Eisentraut authored
      Put the "atomic" argument of ExecuteDoStmt() and ExecuteCallStmt() into
      a variable instead of repeating the formula.
      52f3a9d6
    • Peter Eisentraut's avatar
      Further fix interaction of Perl and stdbool.h · 66ee8513
      Peter Eisentraut authored
      In the case that PostgreSQL uses stdbool.h but Perl doesn't, we need to
      prevent Perl from defining bool, to prevent compiler warnings about
      redefinition.
      66ee8513
    • Tom Lane's avatar
      Fix make rules that generate multiple output files. · 4b538727
      Tom Lane authored
      For years, our makefiles have correctly observed that "there is no correct
      way to write a rule that generates two files".  However, what we did is to
      provide empty rules that "generate" the secondary output files from the
      primary one, and that's not right either.  Depending on the details of
      the creating process, the primary file might end up timestamped later than
      one or more secondary files, causing subsequent make runs to consider the
      secondary file(s) out of date.  That's harmless in a plain build, since
      make will just re-execute the empty rule and nothing happens.  But it's
      fatal in a VPATH build, since make will expect the secondary file to be
      rebuilt in the build directory.  This would manifest as "file not found"
      failures during VPATH builds from tarballs, if we were ever unlucky enough
      to ship a tarball with apparently out-of-date secondary files.  (It's not
      clear whether that has ever actually happened, but it definitely could.)
      
      To ensure that secondary output files have timestamps >= their primary's,
      change our makefile convention to be that we provide a "touch $@" action
      not an empty rule.  Also, make sure that this rule actually gets invoked
      during a distprep run, else the hazard remains.
      
      It's been like this a long time, so back-patch to all supported branches.
      
      In HEAD, I skipped the changes in src/backend/catalog/Makefile, because
      those rules are due to get replaced soon in the bootstrap data format
      patch, and there seems no need to create a merge issue for that patch.
      If for some reason we fail to land that patch in v11, we'll need to
      back-fill the changes in that one makefile from v10.
      
      Discussion: https://postgr.es/m/18556.1521668179@sss.pgh.pa.us
      4b538727
    • Teodor Sigaev's avatar
      Exclude unlogged tables from base backups · 8694cc96
      Teodor Sigaev authored
      Exclude unlogged tables from base backup entirely except init fork which marks
      created unlogged table. The next question is do not backup temp table but
      it's a story for separate patch.
      
      Author: David Steele
      Review by: Adam Brightwell, Masahiko Sawada
      Discussion: https://www.postgresql.org/message-id/flat/04791bab-cb04-ba43-e9c0-664a4c1ffb2c@pgmasters.net
      8694cc96
    • Peter Eisentraut's avatar
      Fix interaction of Perl and stdbool.h · 7ba7986f
      Peter Eisentraut authored
      Revert the PL/Perl-specific change in
      9a95a77d.  We must not prevent Perl from
      using stdbool.h when it has been built to do so, even if it uses an
      incompatible size.  Otherwise, we would be imposing our bool on Perl,
      which will lead to crashes because of the size mismatch.
      
      Instead, we undef bool after including the Perl headers, as we did
      previously, but now only if we are not using stdbool.h ourselves.
      Record that choice in c.h as USE_STDBOOL.  This will also make it easier
      to apply that coding pattern elsewhere if necessary.
      7ba7986f
    • Peter Eisentraut's avatar
      pg_resetwal: Prevent division-by-zero errors · f1a074b1
      Peter Eisentraut authored
      Handle the case where the pg_control file specifies a WAL segment size
      of 0 bytes.  This would previously have led to a division by zero error.
      Change this to assume the whole file is corrupt and go to guess
      everything.
      
      Discussion: https://www.postgresql.org/message-id/a6163ad7-cc99-fdd1-dfad-25df73032ab8%402ndquadrant.com
      f1a074b1
    • Alvaro Herrera's avatar
      Allow FOR EACH ROW triggers on partitioned tables · 86f57594
      Alvaro Herrera authored
      Previously, FOR EACH ROW triggers were not allowed in partitioned
      tables.  Now we allow AFTER triggers on them, and on trigger creation we
      cascade to create an identical trigger in each partition.  We also clone
      the triggers to each partition that is created or attached later.
      
      This means that deferred unique keys are allowed on partitioned tables,
      too.
      
      Author: Álvaro Herrera
      Reviewed-by: Peter Eisentraut, Simon Riggs, Amit Langote, Robert Haas,
      	Thomas Munro
      Discussion: https://postgr.es/m/20171229225319.ajltgss2ojkfd3kp@alvherre.pgsql
      86f57594
    • Peter Eisentraut's avatar
      pg_resetwal: Add simple test suite · 5700aa13
      Peter Eisentraut authored
      Some subsequent patches will add to this, but to avoid conflicts, set up
      the basics separately.
      5700aa13
    • Andres Freund's avatar
      Adapt expression JIT to stdbool.h introduction. · 2111a48a
      Andres Freund authored
      The LLVM JIT provider uses clang to synchronize types between normal C
      code and runtime generated code. Clang represents stdbool.h style
      booleans in return values & parameters differently from booleans
      stored in variables.
      
      Thus the expression compilation code from 2a0faed9 needs to be
      adapted to 9a95a77d. Instead of hardcoding i8 as the type for
      booleans (which already was wrong on some edge case platforms!), use
      postgres' notion of a boolean as used for storage and for parameters.
      
      Per buildfarm animal xenodermus.
      
      Author: Andres Freund
      2111a48a
    • Peter Eisentraut's avatar
      Fix whitespace · fdb78948
      Peter Eisentraut authored
      fdb78948
    • Peter Eisentraut's avatar
      Remove stdbool workaround in sepgsql · 5c4920be
      Peter Eisentraut authored
      Since we now use stdbool.h in c.h, this workaround breaks the build and
      is no longer necessary, so remove it.  (Technically, there could be
      platforms with a 4-byte bool in stdbool.h, in which case we would not
      include stdbool.h in c.h, and so the old problem that caused this
      workaround would reappear.  But this combination is not known to happen
      on the range of platforms where sepgsql can be built.)
      5c4920be
    • Peter Eisentraut's avatar
      Use stdbool.h if suitable · 9a95a77d
      Peter Eisentraut authored
      Using the standard bool type provided by C allows some recent compilers
      and debuggers to give better diagnostics.  Also, some extension code and
      third-party headers are increasingly pulling in stdbool.h, so it's
      probably saner if everyone uses the same definition.
      
      But PostgreSQL code is not prepared to handle bool of a size other than
      1, so we keep our own old definition if we encounter a stdbool.h with a
      bool of a different size.  (Among current build farm members, this only
      applies to old macOS versions on PowerPC.)
      
      To check that the used bool is of the right size, add a static
      assertions about size of GinTernaryValue vs bool.  This is currently the
      only place that assumes that bool and char are of the same size.
      
      Discussion: https://www.postgresql.org/message-id/flat/3a0fe7e1-5ed1-414b-9230-53bbc0ed1f49@2ndquadrant.com
      9a95a77d
  5. 22 Mar, 2018 7 commits
    • Andres Freund's avatar
      Add expression compilation support to LLVM JIT provider. · 2a0faed9
      Andres Freund authored
      In addition to the interpretation of expressions (which back
      evaluation of WHERE clauses, target list projection, aggregates
      transition values etc) support compiling expressions to native code,
      using the infrastructure added in earlier commits.
      
      To avoid duplicating a lot of code, only support emitting code for
      cases that are likely to be performance critical. For expression steps
      that aren't deemed that, use the existing interpreter.
      
      The generated code isn't great - some architectural changes are
      required to address that. But this already yields a significant
      speedup for some analytics queries, particularly with WHERE clauses
      filtering a lot, or computing multiple aggregates.
      
      Author: Andres Freund
      Tested-By: Thomas Munro
      Discussion: https://postgr.es/m/20170901064131.tazjxwus3k2w3ybh@alap3.anarazel.de
      
      Disable JITing for VALUES() nodes.
      
      VALUES() nodes are only ever executed once. This is primarily helpful
      for debugging, when forcing JITing even for cheap queries.
      
      Author: Andres Freund
      Discussion: https://postgr.es/m/20170901064131.tazjxwus3k2w3ybh@alap3.anarazel.de
      2a0faed9
    • Andres Freund's avatar
      Add FIELDNO_* macro designating offset into structs required for JIT. · 7ced1d12
      Andres Freund authored
      For any interesting JIT target, fields inside structs need to be
      accessed. b96d550e contains infrastructure for syncing the definition
      of types between postgres C code and runtime code generation with
      LLVM. But that doesn't sync the number or names of fields inside
      structs, just the types (including padding etc).
      
      One option would be to hardcode the offset numbers in the JIT code,
      but that'd be hard to keep in sync. Instead add macros indicating the
      field offset to the fields that need to be accessed. Not pretty, but
      manageable.
      
      Author: Andres Freund
      Discussion: https://postgr.es/m/20170901064131.tazjxwus3k2w3ybh@alap3.anarazel.de
      7ced1d12
    • Andres Freund's avatar
    • Tom Lane's avatar
      Improve style guideline compliance of assorted error-report messages. · feb82545
      Tom Lane authored
      Per the project style guide, details and hints should have leading
      capitalization and end with a period.  On the other hand, errcontext should
      not be capitalized and should not end with a period.  To support well
      formatted error contexts in dblink, extend dblink_res_error() to take a
      format+arguments rather than a hardcoded string.
      
      Daniel Gustafsson
      
      Discussion: https://postgr.es/m/B3C002C8-21A0-4F53-A06E-8CAB29FCF295@yesql.se
      feb82545
    • Robert Haas's avatar
      Consider Parallel Append of partial paths for UNION [ALL]. · 88ba0ae2
      Robert Haas authored
      Without this patch, we can implement a UNION or UNION ALL as an
      Append where Gather appears beneath one or more of the Append
      branches, but this lets us put the Gather node on top, with
      a partial path for each relation underneath.
      
      There is considerably more work that could be done to improve
      planning in this area, but that will probably need to wait
      for a future release.
      
      Patch by me, reviewed and tested by Ashutosh Bapat and Rajkumar
      Raghuwanshi.
      
      Discussion: http://postgr.es/m/CA+TgmoaLRAOqHmMZx=ESM3VDEPceg+-XXZsRXQ8GtFJO_zbMSw@mail.gmail.com
      88ba0ae2
    • Tom Lane's avatar
      Sync up our various ways of estimating pg_class.reltuples. · 7c91a036
      Tom Lane authored
      VACUUM thought that reltuples represents the total number of tuples in
      the relation, while ANALYZE counted only live tuples.  This can cause
      "flapping" in the value when background vacuums and analyzes happen
      separately.  The planner's use of reltuples essentially assumes that
      it's the count of live (visible) tuples, so let's standardize on having
      it mean live tuples.
      
      Another issue is that the definition of "live tuple" isn't totally clear;
      what should be done with INSERT_IN_PROGRESS or DELETE_IN_PROGRESS tuples?
      ANALYZE's choices in this regard are made on the assumption that if the
      originating transaction commits at all, it will happen after ANALYZE
      finishes, so we should ignore the effects of the in-progress transaction
      --- unless it is our own transaction, and then we should count it.
      Let's propagate this definition into VACUUM, too.
      
      Likewise propagate this definition into CREATE INDEX, and into
      contrib/pgstattuple's pgstattuple_approx() function.
      
      Tomas Vondra, reviewed by Haribabu Kommi, some corrections by me
      
      Discussion: https://postgr.es/m/16db4468-edfa-830a-f921-39a50498e77e@2ndquadrant.com
      7c91a036
    • Andres Freund's avatar
      Basic planner and executor integration for JIT. · cc415a56
      Andres Freund authored
      This adds simple cost based plan time decision about whether JIT
      should be performed. jit_above_cost, jit_optimize_above_cost are
      compared with the total cost of a plan, and if the cost is above them
      JIT is performed / optimization is performed respectively.
      
      For that PlannedStmt and EState have a jitFlags (es_jit_flags) field
      that stores information about what JIT operations should be performed.
      
      EState now also has a new es_jit field, which can store a
      JitContext. When there are no errors the context is released in
      standard_ExecutorEnd().
      
      It is likely that the default values for jit_[optimize_]above_cost
      will need to be adapted further, but in my test these values seem to
      work reasonably.
      
      Author: Andres Freund, with feedback by Peter Eisentraut
      Discussion: https://postgr.es/m/20170901064131.tazjxwus3k2w3ybh@alap3.anarazel.de
      cc415a56