1. 28 Mar, 2018 3 commits
    • Andres Freund's avatar
      Quick adaption of JIT tuple deforming to the fast default patch. · f4f5845b
      Andres Freund authored
      Instead using memset to set tts_isnull, call the new
      slot_getmissingattrs().
      
      Also fix a bug (= instead of >=) in the code generation. Normally = is
      correct, but when repeatedly deforming fields not in a
      tuple (e.g. deform up to natts + 1 and then natts + 2) >= is needed.
      
      Discussion: https://postgr.es/m/20180328010053.i2qvsuuusst4lgmc@alap3.anarazel.de
      f4f5845b
    • Andres Freund's avatar
      Add catversion bump missed in 16828d5c. · b4013b8e
      Andres Freund authored
      Given that pg_attribute changed its layout...
      b4013b8e
    • Andrew Dunstan's avatar
      Fast ALTER TABLE ADD COLUMN with a non-NULL default · 16828d5c
      Andrew Dunstan authored
      Currently adding a column to a table with a non-NULL default results in
      a rewrite of the table. For large tables this can be both expensive and
      disruptive. This patch removes the need for the rewrite as long as the
      default value is not volatile. The default expression is evaluated at
      the time of the ALTER TABLE and the result stored in a new column
      (attmissingval) in pg_attribute, and a new column (atthasmissing) is set
      to true. Any existing row when fetched will be supplied with the
      attmissingval. New rows will have the supplied value or the default and
      so will never need the attmissingval.
      
      Any time the table is rewritten all the atthasmissing and attmissingval
      settings for the attributes are cleared, as they are no longer needed.
      
      The most visible code change from this is in heap_attisnull, which
      acquires a third TupleDesc argument, allowing it to detect a missing
      value if there is one. In many cases where it is known that there will
      not be any (e.g.  catalog relations) NULL can be passed for this
      argument.
      
      Andrew Dunstan, heavily modified from an original patch from Serge
      Rielau.
      Reviewed by Tom Lane, Andres Freund, Tomas Vondra and David Rowley.
      
      Discussion: https://postgr.es/m/31e2e921-7002-4c27-59f5-51f08404c858@2ndQuadrant.com
      16828d5c
  2. 27 Mar, 2018 7 commits
    • Tom Lane's avatar
      Update pgindent's typedefs blacklist, and make it easier to adjust. · ef1978d6
      Tom Lane authored
      It seems that all buildfarm members are now using the <stdbool.h> code
      path, so that none of them report "bool" as a typedef.  We still need it
      to be treated that way, so adjust pgindent to force that whether or not
      it's in the given list.
      
      Also, the recent introduction of LLVM infrastructure has caused the
      appearance of some typedef names that we definitely *don't* want
      treated as typedefs, such as "string" and "abs".  Extend the existing
      blacklist to include these.  (Additions based on comparing v10's
      typedefs list to what the buildfarm is currently emitting.)
      
      Rearrange the code so that the lists of whitelisted/blacklisted
      names are a bit easier to find and modify.
      
      Andrew Dunstan and Tom Lane
      
      Discussion: https://postgr.es/m/28690.1521912334@sss.pgh.pa.us
      ef1978d6
    • Tom Lane's avatar
      Allow memory contexts to have both fixed and variable ident strings. · 442accc3
      Tom Lane authored
      Originally, we treated memory context names as potentially variable in
      all cases, and therefore always copied them into the context header.
      Commit 9fa6f00b rethought this a little bit and invented a distinction
      between fixed and variable names, skipping the copy step for the former.
      But we can make things both simpler and more useful by instead allowing
      there to be two parts to a context's identification, a fixed "name" and
      an optional, variable "ident".  The name supplied in the context create
      call is now required to be a compile-time-constant string in all cases,
      as it is never copied but just pointed to.  The "ident" string, if
      wanted, is supplied later.  This is needed because typically we want
      the ident to be stored inside the context so that it's cleaned up
      automatically on context deletion; that means it has to be copied into
      the context before we can set the pointer.
      
      The cost of this approach is basically just an additional pointer field
      in struct MemoryContextData, which isn't much overhead, and is bought
      back entirely in the AllocSet case by not needing a headerSize field
      anymore, since we no longer have to cope with variable header length.
      In addition, we can simplify the internal interfaces for memory context
      creation still further, saving a few cycles there.  And it's no longer
      true that a custom identifier disqualifies a context from participating
      in aset.c's freelist scheme, so possibly there's some win on that end.
      
      All the places that were using non-compile-time-constant context names
      are adjusted to put the variable info into the "ident" instead.  This
      allows more effective identification of those contexts in many cases;
      for example, subsidary contexts of relcache entries are now identified
      by both type (e.g. "index info") and relname, where before you got only
      one or the other.  Contexts associated with PL function cache entries
      are now identified more fully and uniformly, too.
      
      I also arranged for plancache contexts to use the query source string
      as their identifier.  This is basically free for CachedPlanSources, as
      they contained a copy of that string already.  We pay an extra pstrdup
      to do it for CachedPlans.  That could perhaps be avoided, but it would
      make things more fragile (since the CachedPlanSource is sometimes
      destroyed first).  I suspect future improvements in error reporting will
      require CachedPlans to have a copy of that string anyway, so it's not
      clear that it's worth moving mountains to avoid it now.
      
      This also changes the APIs for context statistics routines so that the
      context-specific routines no longer assume that output goes straight
      to stderr, nor do they know all details of the output format.  This
      is useful immediately to reduce code duplication, and it also allows
      for external code to do something with stats output that's different
      from printing to stderr.
      
      The reason for pushing this now rather than waiting for v12 is that
      it rethinks some of the API changes made by commit 9fa6f00b.  Seems
      better for extension authors to endure just one round of API changes
      not two.
      
      Discussion: https://postgr.es/m/CAB=Je-FdtmFZ9y9REHD7VsSrnCkiBhsA4mdsLKSPauwXtQBeNA@mail.gmail.com
      442accc3
    • Simon Riggs's avatar
      Allow HOT updates for some expression indexes · c203d6cf
      Simon Riggs authored
      If the value of an index expression is unchanged after UPDATE,
      allow HOT updates where previously we disallowed them, giving
      a significant performance boost in those cases.
      
      Particularly useful for indexes such as JSON->>field where the
      JSON value changes but the indexed value does not.
      
      Submitted as "surjective indexes" patch, now enabled by use
      of new "recheck_on_update" parameter.
      
      Author: Konstantin Knizhnik
      Reviewer: Simon Riggs, with much wordsmithing and some cleanup
      c203d6cf
    • Peter Eisentraut's avatar
      libpq: PQhost to return active connected host or hostaddr · 1944cdc9
      Peter Eisentraut authored
      Previously, PQhost didn't return the connected host details when the
      connection type was CHT_HOST_ADDRESS (i.e., via hostaddr).  Instead, it
      returned the complete host connection parameter (which could contain
      multiple hosts) or the default host details, which was confusing and
      arguably incorrect.
      
      Change this to return the actually connected host or hostaddr
      irrespective of the connection type.  When hostaddr but no host was
      specified, hostaddr is now returned.  Never return the original host
      connection parameter, and document that PQhost cannot be relied on
      before the connection is established.
      
      PQport is similarly changed to always return the active connection port
      and never the original connection parameter.
      
      Author: Hari Babu <kommi.haribabu@gmail.com>
      Reviewed-by: default avatarMichael Paquier <michael@paquier.xyz>
      Reviewed-by: default avatarKyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
      Reviewed-by: default avatarDavid G. Johnston <david.g.johnston@gmail.com>
      1944cdc9
    • Teodor Sigaev's avatar
      Fix count of skipped test of basebackup on Windows · 44bd9584
      Teodor Sigaev authored
      Commit 920a5e50 add tests which should be
      skipped on Windows boxes, but patch doesn't contain right count of them.
      
      David Steel
      44bd9584
    • Teodor Sigaev's avatar
      Skip temp tables from basebackup. · 920a5e50
      Teodor Sigaev authored
      Do not store temp tables in basebackup, they will not be visible anyway, so,
      there are not reasons to store them.
      
      Author: David Steel
      Reviewed by: me
      Discussion: https://www.postgresql.org/message-id/flat/5ea4d26a-a453-c1b7-eff9-5a3ef8f8aceb@pgmasters.net
      920a5e50
    • Teodor Sigaev's avatar
      Add predicate locking for GiST · 3ad55863
      Teodor Sigaev authored
      Add page-level predicate locking, due to gist's code organization, patch seems
      close to trivial: add check before page changing, add predicate lock before page
      scanning.  Although choosing right place to check is not simple: it should not
      be called during index build, it should support insertion of new downlink and so
      on.
      
      Author: Shubham Barai with editorization by me and Alexander Korotkov
      Reviewed by: Alexander Korotkov, Andrey Borodin, me
      Discussion: https://www.postgresql.org/message-id/flat/CALxAEPtdcANpw5ePU3LvnTP8HCENFw6wygupQAyNBgD-sG3h0g@mail.gmail.com
      3ad55863
  3. 26 Mar, 2018 12 commits
  4. 25 Mar, 2018 11 commits
  5. 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
  6. 23 Mar, 2018 4 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