1. 26 Mar, 2021 2 commits
    • Tomas Vondra's avatar
      Support the old signature of BRIN consistent function · a681e3c1
      Tomas Vondra authored
      Commit a1c649d8 changed the signature of the BRIN consistent function
      by adding a new required parameter.  Treating the parameter as optional,
      which would make the change backwards incompatibile, was rejected with
      the justification that there are few out-of-core extensions, so it's not
      worth adding making the code more complex, and it's better to deal with
      that in the extension.
      
      But after further thought, that would be rather problematic, because
      pg_upgrade simply dumps catalog contents and the same version of an
      extension needs to work on both PostgreSQL versions. Supporting both
      variants of the consistent function (with 3 or 4 arguments) makes that
      possible.
      
      The signature is not the only thing that changed, as commit 72ccf55c
      moved handling of IS [NOT] NULL keys from the support procedures. But
      this change is backward compatible - handling the keys in exension is
      unnecessary, but harmless. The consistent function will do a bit of
      unnecessary work, but it should be very cheap.
      
      This also undoes most of the changes to the existing opclasses (minmax
      and inclusion), making them use the old signature again. This should
      make backpatching simpler.
      
      Catversion bump, because of changes in pg_amproc.
      
      Author: Tomas Vondra <tomas.vondra@postgresql.org>
      Author: Nikita Glukhov <n.gluhov@postgrespro.ru>
      Reviewed-by: default avatarMark Dilger <hornschnorter@gmail.com>
      Reviewed-by: default avatarAlexander Korotkov <aekorotkov@gmail.com>
      Reviewed-by: default avatarMasahiko Sawada <masahiko.sawada@enterprisedb.com>
      Reviewed-by: default avatarJohn Naylor <john.naylor@enterprisedb.com>
      Discussion: https://postgr.es/m/c1138ead-7668-f0e1-0638-c3be3237e812@2ndquadrant.com
      a681e3c1
    • Tomas Vondra's avatar
      Remove unnecessary pg_amproc BRIN minmax entries · a68dfa27
      Tomas Vondra authored
      The BRIN minmax opclasses included amproc entries with mismatching left
      and right types, but those happen to be unnecessary.  The opclasses only
      need cross-type operators, not cross-type support procedures. Discovered
      when trying to define equivalent BRIN operator families in an extension.
      
      Catversion bump, because of pg_amproc changes.
      
      Author: Tomas Vondra
      Reviewed-by: Alvaro Herrera
      Discussion: https://postgr.es/m/78c357ab-3395-8433-e7b3-b2cfcc9fdc23%40enterprisedb.com
      a68dfa27
  2. 25 Mar, 2021 12 commits
  3. 24 Mar, 2021 13 commits
  4. 23 Mar, 2021 13 commits
    • Tomas Vondra's avatar
      Allow composite types in catalog bootstrap · 79f6a942
      Tomas Vondra authored
      When resolving types during catalog bootstrap, try to reload the pg_type
      contents if a type is not found. That allows catalogs to contain
      composite types, e.g. row types for other catalogs.
      
      Author: Justin Pryzby
      Reviewed-by: Dean Rasheed, Tomas Vondra
      Discussion: https://postgr.es/m/ad7891d2-e90c-b446-9fe2-7419143847d7%40enterprisedb.com
      79f6a942
    • Tomas Vondra's avatar
      Convert Typ from array to list in bootstrap · e1a5e657
      Tomas Vondra authored
      It's a bit easier and more convenient to free and reload a List,
      compared to a plain array. This will be helpful when allowing catalogs
      to contain composite types.
      
      Author: Justin Pryzby
      Reviewed-by: Dean Rasheed, Tomas Vondra
      Discussion: https://postgr.es/m/ad7891d2-e90c-b446-9fe2-7419143847d7%40enterprisedb.com
      e1a5e657
    • Peter Geoghegan's avatar
      nbtree VACUUM: Cope with buggy opclasses. · 5b861baa
      Peter Geoghegan authored
      Teach nbtree VACUUM to press on with vacuuming in the event of a page
      deletion attempt that fails to "re-find" a downlink for its child/target
      page.
      
      There is no good reason to treat this as an irrecoverable error.  But
      there is a good reason not to: pressing on at this point removes any
      question of VACUUM not making progress solely due to misbehavior from
      user-defined operator class code.
      
      Discussion: https://postgr.es/m/CAH2-Wzma5G9CTtMjbrXTwOym+U=aWg-R7=-htySuztgoJLvZXg@mail.gmail.com
      5b861baa
    • Robert Haas's avatar
      Improve pg_amcheck's TAP test 003_check.pl. · 87d90ac6
      Robert Haas authored
      Disable autovacuum, because we don't want it to run against
      intentionally corrupted tables. Also, before corrupting the tables,
      run pg_amcheck and ensure that it passes. Otherwise, if something
      unexpected happens when we check the corrupted tables, it's not so
      clear whether it would have also happened before we corrupted
      them.
      
      Mark Dilger
      
      Discussion: http://postgr.es/m/AA5506CE-7D2A-42E4-A51D-358635E3722D@enterprisedb.com
      87d90ac6
    • Tom Lane's avatar
      Fix psql's \connect command some more. · ea801385
      Tom Lane authored
      Jasen Betts reported yet another unintended side effect of commit
      85c54287: reconnecting with "\c service=whatever" did not have the
      expected results.  The reason is that starting from the output of
      PQconndefaults() effectively allows environment variables (such
      as PGPORT) to override entries in the service file, whereas the
      normal priority is the other way around.
      
      Not using PQconndefaults at all would require yet a third main code
      path in do_connect's parameter setup, so I don't really want to fix
      it that way.  But we can have the logic effectively ignore all the
      default values for just a couple more lines of code.
      
      This patch doesn't change the behavior for "\c -reuse-previous=on
      service=whatever".  That remains significantly different from before
      85c54287, because many more parameters will be re-used, and thus
      not be possible for service entries to replace.  But I think this
      is (mostly?) intentional.  In any case, since libpq does not report
      where it got parameter values from, it's hard to do differently.
      
      Per bug #16936 from Jasen Betts.  As with the previous patches,
      back-patch to all supported branches.  (9.5 is unfortunately now
      out of support, so this won't get fixed there.)
      
      Discussion: https://postgr.es/m/16936-3f524322a53a29f0@postgresql.org
      ea801385
    • Tom Lane's avatar
      Avoid possible crash while finishing up a heap rewrite. · 9d523119
      Tom Lane authored
      end_heap_rewrite was not careful to ensure that the target relation
      is open at the smgr level before performing its final smgrimmedsync.
      In ordinary cases this is no problem, because it would have been
      opened earlier during the rewrite.  However a crash can be reproduced
      by re-clustering an empty table with CLOBBER_CACHE_ALWAYS enabled.
      
      Although that exact scenario does not crash in v13, I think that's
      a chance result of unrelated planner changes, and the problem is
      likely still reachable with other test cases.  The true proximate
      cause of this failure is commit c6b92041, which replaced a call to
      heap_sync (which was careful about opening smgr) with a direct call
      to smgrimmedsync.  Hence, back-patch to v13.
      
      Amul Sul, per report from Neha Sharma; cosmetic changes
      and test case by me.
      
      Discussion: https://postgr.es/m/CANiYTQsU7yMFpQYnv=BrcRVqK_3U3mtAzAsJCaqtzsDHfsUbdQ@mail.gmail.com
      9d523119
    • Peter Eisentraut's avatar
      pgcrypto: Check for error return of px_cipher_decrypt() · 22e1943f
      Peter Eisentraut authored
      This has previously not been a problem (that anyone ever reported),
      but in future OpenSSL versions (3.0.0), where legacy ciphers are/can
      be disabled, this is the place where this is reported.  So we need to
      catch the error here, otherwise the higher-level functions would
      return garbage.  The nearby encryption code already handled errors
      similarly.
      Reviewed-by: default avatarDaniel Gustafsson <daniel@yesql.se>
      Discussion: https://www.postgresql.org/message-id/9e9c431c-0adc-7a6d-9b1a-915de1ba3fe7@enterprisedb.com
      22e1943f
    • Peter Eisentraut's avatar
      Add bit_count SQL function · a6715af1
      Peter Eisentraut authored
      This function for bit and bytea counts the set bits in the bit or byte
      string.  Internally, we use the existing popcount functionality.
      
      For the name, after some discussion, we settled on bit_count, which
      also exists with this meaning in MySQL, Java, and Python.
      
      Author: David Fetter <david@fetter.org>
      Discussion: https://www.postgresql.org/message-id/flat/20201230105535.GJ13234@fetter.org
      a6715af1
    • Michael Paquier's avatar
      Add per-index stats information in verbose logs of autovacuum · 5aed6a1f
      Michael Paquier authored
      Once a relation's autovacuum is completed, the logs include more
      information about this relation state if the threshold of
      log_autovacuum_min_duration (or its relation option) is reached, with
      for example contents about the statistics of the VACUUM operation for
      the relation, WAL and system usage.
      
      This commit adds more information about the statistics of the relation's
      indexes, with one line of logs generated for each index.  The index
      stats were already calculated, but not printed in the context of
      autovacuum yet.  While on it, some refactoring is done to keep track of
      the index statistics directly within LVRelStats, simplifying some
      routines related to parallel VACUUMs.
      
      Author: Masahiko Sawada
      Reviewed-by: Michael Paquier, Euler Taveira
      Discussion: https://postgr.es/m/CAD21AoAy6SxHiTivh5yAPJSUE4S=QRPpSZUdafOSz0R+fRcM6Q@mail.gmail.com
      5aed6a1f
    • Amit Kapila's avatar
      Fix dangling pointer reference in stream_cleanup_files. · 4b82ed6e
      Amit Kapila authored
      We can't access the entry after it is removed from dynahash.
      
      Author: Peter Smith
      Discussion: https://postgr.es/m/CAHut+Ps-pL++f6CJwPx2+vUqXuew=Xt-9Bi-6kCyxn+Fwi2M7w@mail.gmail.com
      4b82ed6e
    • Tomas Vondra's avatar
      Use correct spelling of statistics kind · a5f002ad
      Tomas Vondra authored
      A couple error messages and comments used 'statistic kind', not the
      correct 'statistics kind'. Fix and backpatch all the way back to 10,
      where extended statistics were introduced.
      
      Backpatch-through: 10
      a5f002ad
    • Fujii Masao's avatar
      Change the type of WalReceiverWaitStart wait event from Client to IPC. · 1e3e8b51
      Fujii Masao authored
      Previously the type of this wait event was Client. But while this
      wait event is being reported, walreceiver process is waiting for
      the startup process to set initial data for streaming replication.
      It's not waiting for any activity on a socket connected to a user
      application or walsender. So this commit changes the type for
      WalReceiverWaitStart wait event to IPC.
      
      Author: Fujii Masao
      Reviewed-by: Kyotaro Horiguchi
      Discussion: https://postgr.es/m/cdacc27c-37ff-f1a4-20e2-ce19933abfcc@oss.nttdata.com
      1e3e8b51
    • Fujii Masao's avatar
      pg_waldump: Fix bug in per-record statistics. · 51893c84
      Fujii Masao authored
      pg_waldump --stats=record identifies a record by a combination
      of the RmgrId and the four bits of the xl_info field of the record.
      But XACT records use the first bit of those four bits for an optional
      flag variable, and the following three bits for the opcode to
      identify a record. So previously the same type of XACT record
      could have different four bits (three bits are the same but the
      first one bit is different), and which could cause
      pg_waldump --stats=record to show two lines of per-record statistics
      for the same XACT record. This is a bug.
      
      This commit changes pg_waldump --stats=record so that it processes
      only XACT record differently, i.e., filters the opcode out of xl_info
      and uses a combination of the RmgrId and those three bits as
      the identifier of a record, only for XACT record. For other records,
      the four bits of the xl_info field are still used.
      
      Back-patch to all supported branches.
      
      Author: Kyotaro Horiguchi
      Reviewed-by: Shinya Kato, Fujii Masao
      Discussion: https://postgr.es/m/2020100913412132258847@highgo.ca
      51893c84