1. 21 Nov, 2020 4 commits
  2. 20 Nov, 2020 6 commits
  3. 19 Nov, 2020 6 commits
    • Tom Lane's avatar
      Remove undocumented IS [NOT] OF syntax. · 926fa801
      Tom Lane authored
      This feature was added a long time ago, in 7c1e67bd and eb121ba2,
      but never documented in any user-facing way.  (Documentation added
      in 6126d3e7 was commented out almost immediately, in 8272fc3f.)
      That's because, while this syntax is defined by SQL:99, our
      implementation is only vaguely related to the standard's semantics.
      The standard appears to intend a run-time not parse-time test, and
      it definitely intends that the test should understand subtype
      relationships.
      
      No one has stepped up to fix that in the intervening years, but
      people keep coming across the code and asking why it's not documented.
      Let's just get rid of it: if anyone ever wants to make it work per
      spec, they can easily recover whatever parts of this code are still
      of value from our git history.
      
      If there's anyone out there who's actually using this despite its
      undocumented status, they can switch to using pg_typeof() instead,
      eg. "pg_typeof(something) = 'mytype'::regtype".  That gives
      essentially the same semantics as what our IS OF code did.
      (We didn't have that function last time this was discussed, or
      we would have ripped out IS OF then.)
      
      Discussion: https://postgr.es/m/CAKFQuwZ2pTc-DSkOiTfjauqLYkNREeNZvWmeg12Q-_69D+sYZA@mail.gmail.com
      Discussion: https://postgr.es/m/BAY20-F23E9F2B4DAB3E4E88D3623F99B0@phx.gbl
      Discussion: https://postgr.es/m/3E7CF81D.1000203@joeconway.com
      926fa801
    • Tom Lane's avatar
      Further fixes for CREATE TABLE LIKE: cope with self-referential FKs. · 97390fe8
      Tom Lane authored
      Commit 50289819 was too careless about the order of execution of the
      additional ALTER TABLE operations generated by expandTableLikeClause.
      It just stuck them all at the end, which seems okay for most purposes.
      But it falls down in the case where LIKE is importing a primary key
      or unique index and the outer CREATE TABLE includes a FOREIGN KEY
      constraint that needs to depend on that index.  Weird as that is,
      it used to work, so we ought to keep it working.
      
      To fix, make parse_utilcmd.c insert LIKE clauses between index-creation
      and FK-creation commands in the transformed list of commands, and change
      utility.c so that the commands generated by expandTableLikeClause are
      executed immediately not at the end.  One could imagine scenarios where
      this wouldn't work either; but currently expandTableLikeClause only
      makes column default expressions, CHECK constraints, and indexes, and
      this ordering seems fine for those.
      
      Per bug #16730 from Sofoklis Papasofokli.  Like the previous patch,
      back-patch to all supported branches.
      
      Discussion: https://postgr.es/m/16730-b902f7e6e0276b30@postgresql.org
      97390fe8
    • Peter Eisentraut's avatar
      Rename object in test to avoid conflict · afaccbba
      Peter Eisentraut authored
      In 01e658fa, the hash_func test
      creates a type t1, but apparently a test running in parallel might
      also use that name, depending on timing.  Rename the type to avoid the
      issue.
      afaccbba
    • Peter Eisentraut's avatar
      Hash support for row types · 01e658fa
      Peter Eisentraut authored
      Add hash functions for the record type as well as a hash operator
      family and operator class for the record type.  This enables all the
      hash functionality for the record type such as hash-based plans for
      UNION/INTERSECT/EXCEPT DISTINCT, recursive queries using UNION
      DISTINCT, hash joins, and hash partitioning.
      Reviewed-by: default avatarTom Lane <tgl@sss.pgh.pa.us>
      Discussion: https://www.postgresql.org/message-id/flat/38eccd35-4e2d-6767-1b3c-dada1eac3124%402ndquadrant.com
      01e658fa
    • Thomas Munro's avatar
      Add BarrierArriveAndDetachExceptLast(). · 7888b099
      Thomas Munro authored
      Provide a way for one process to continue the remaining phases of a
      (previously) parallel computation alone.  Later patches will use this to
      extend Parallel Hash Join.
      
      Author: Melanie Plageman <melanieplageman@gmail.com>
      Reviewed-by: default avatarThomas Munro <thomas.munro@gmail.com>
      Discussion: https://postgr.es/m/CA%2BhUKG%2BA6ftXPz4oe92%2Bx8Er%2BxpGZqto70-Q_ERwRaSyA%3DafNg%40mail.gmail.com
      7888b099
    • Michael Paquier's avatar
      Improve failure detection with array parsing in pg_dump · 13b58f89
      Michael Paquier authored
      Similarly to 3636efa1, the checks done in pg_dump when parsing array
      values from catalogs have been too lax.  Under memory pressure, it could
      be possible, though very unlikely, to finish with dumps that miss some
      data like:
      - Statistics for indexes
      - Run-time configuration of functions
      - Configuration of extensions
      - Publication list for a subscription
      
      No backpatch is done as this is not going to be a problem in practice.
      For example, if an OOM causes an array parsing to fail, a follow-up code
      path of pg_dump would most likely complain with an allocation failure
      due to the memory pressure.
      
      Author: Michael Paquier
      Reviewed-by: Daniel Gustafsson
      Discussion: https://postgr.es/m/20201111061319.GE2276@paquier.xyz
      13b58f89
  4. 18 Nov, 2020 5 commits
  5. 17 Nov, 2020 5 commits
    • Peter Geoghegan's avatar
      Deprecate nbtree's BTP_HAS_GARBAGE flag. · cf2acaf4
      Peter Geoghegan authored
      Streamline handling of the various strategies that we have to avoid a
      page split in nbtinsert.c.  When it looks like a leaf page is about to
      overflow, we now perform deleting LP_DEAD items and deduplication in one
      central place.  This greatly simplifies _bt_findinsertloc().
      
      This has an independently useful consequence: nbtree no longer relies on
      the BTP_HAS_GARBAGE page level flag/hint for anything important.  We
      still set and unset the flag in the same way as before, but it's no
      longer treated as a gating condition when considering if we should check
      for already-set LP_DEAD bits.  This happens at the point where the page
      looks like it might have to be split anyway, so simply checking the
      LP_DEAD bits in passing is practically free.  This avoids missing
      LP_DEAD bits just because the page-level hint is unset, which is
      probably reasonably common (e.g. it happens when VACUUM unsets the
      page-level flag without actually removing index tuples whose LP_DEAD-bit
      was set recently, after the VACUUM operation began but before it reached
      the leaf page in question).
      
      Note that this isn't a big behavioral change compared to PostgreSQL 13.
      We were already checking for set LP_DEAD bits regardless of whether the
      BTP_HAS_GARBAGE page level flag was set before we considered doing a
      deduplication pass.  This commit only goes slightly further by doing the
      same check for all indexes, even indexes where deduplication won't be
      performed.
      
      We don't completely remove the BTP_HAS_GARBAGE flag.  We still rely on
      it as a gating condition with pg_upgrade'd indexes from before B-tree
      version 4/PostgreSQL 12.  That makes sense because we sometimes have to
      make a choice among pages full of duplicates when inserting a tuple with
      pre version 4 indexes.  It probably still pays to avoid accessing the
      line pointer array of a page there, since it won't yet be clear whether
      we'll insert on to the page in question at all, let alone split it as a
      result.
      
      Author: Peter Geoghegan <pg@bowt.ie>
      Reviewed-By: default avatarVictor Yegorov <vyegorov@gmail.com>
      Discussion: https://postgr.es/m/CAH2-Wz%3DYpc1PDdk8OVJDChGJBjT06%3DA0Mbv9HyTLCsOknGcUFg%40mail.gmail.com
      cf2acaf4
    • Alvaro Herrera's avatar
      indexcmds.c: reorder function prototypes · 7684b6fb
      Alvaro Herrera authored
      ... out of an overabundance of neatnikism, perhaps.
      7684b6fb
    • Peter Geoghegan's avatar
      nbtree: Rename nbtinsert.c variables for consistency. · a034f8b6
      Peter Geoghegan authored
      Stop naming special area/opaque pointer variables 'lpageop' in contexts
      where it doesn't make sense.  This is a holdover from a time when logic
      that performs tasks that are now spread across _bt_insertonpg(),
      _bt_findinsertloc(), and _bt_split() was more centralized.  'lpageop'
      denotes "left page", which doesn't make sense outside of contexts in
      which there isn't also a right page.
      
      Also acquire page flag variables up front within _bt_insertonpg().  This
      makes it closer to _bt_split() following refactoring commit bc3087b6.
      This allows the page split and retail insert paths to both make use of
      the same variables.
      a034f8b6
    • Amit Kapila's avatar
      Fix 'skip-empty-xacts' option in test_decoding for streaming mode. · 9653f24a
      Amit Kapila authored
      In streaming mode, the transaction can be decoded in multiple streams and
      those streams can be interleaved with streams of other transactions. So,
      we can't remember the transaction's write status in the logical decoding
      context because that might get changed due to some other transactions and
      lead to wrong answers for 'skip-empty-xacts' option. We decided to keep
      each transaction's write status in the ReorderBufferTxn to avoid
      interleaved streams changing the status of some unrelated transactions.
      
      Diagnosed-by: Amit Kapila
      Author: Dilip Kumar
      Reviewed-by: Amit Kapila
      Discussion: https://postgr.es/m/CAA4eK1LR7=XNM_TLmpZMFuV8ZQpoxkem--NZJYf8YXmesbvwLA@mail.gmail.com
      9653f24a
    • Tom Lane's avatar
      Don't Insert() a VFD entry until it's fully built. · 2bd49b49
      Tom Lane authored
      Otherwise, if FDDEBUG is enabled, the debugging output fails because
      it tries to read the fileName, which isn't set up yet (and should in
      fact always be NULL).
      
      AFAICT, this has been wrong since Berkeley.  Before 96bf88d5,
      it would accidentally fail to crash on platforms where snprintf()
      is forgiving about being passed a NULL pointer for %s; but the
      file name intended to be included in the debug output wouldn't
      ever have shown up.
      
      Report and fix by Greg Nancarrow.  Although this is only visibly
      broken in custom-made builds, it still seems worth back-patching
      to all supported branches, as the FDDEBUG code is pretty useless
      as it stands.
      
      Discussion: https://postgr.es/m/CAJcOf-cUDgm9qYtC_B6XrC6MktMPNRby2p61EtSGZKnfotMArw@mail.gmail.com
      2bd49b49
  6. 16 Nov, 2020 13 commits
  7. 15 Nov, 2020 1 commit
    • Tom Lane's avatar
      Fix fuzzy thinking about amcanmulticol versus amcaninclude. · 29d29d65
      Tom Lane authored
      These flags should be independent: in particular an index AM should
      be able to say that it supports include columns without necessarily
      supporting multiple key columns.  The included-columns patch got
      this wrong, possibly aided by the fact that it didn't bother to
      update the documentation.
      
      While here, clarify some text about amcanreturn, which was a little
      vague about what should happen when amcanreturn reports that only
      some of the index columns are returnable.
      
      Noted while reviewing the SP-GiST included-columns patch, which
      quite incorrectly (and unsafely) changed SP-GiST to claim
      amcanmulticol = true as a workaround for this bug.
      
      Backpatch to v11 where included columns were introduced.
      29d29d65