1. 13 Jul, 2020 1 commit
  2. 12 Jul, 2020 2 commits
    • Michael Paquier's avatar
      Fix test failure with -DENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS · ea3e15d1
      Michael Paquier authored
      Replication origins created by regression tests should have names
      starting with "regress_", and the test introduced in b1e48bbe for commit
      timestamps did not do that.
      
      Per buildfarm member longfin.
      
      Discussion: https://postgr.es/m/20200712122507.GD21680@paquier.xyz
      ea3e15d1
    • Michael Paquier's avatar
      Include replication origins in SQL functions for commit timestamp · b1e48bbe
      Michael Paquier authored
      This includes two changes:
      - Addition of a new function pg_xact_commit_timestamp_origin() able, for
      a given transaction ID, to return the commit timestamp and replication
      origin of this transaction.  An equivalent function existed in
      pglogical.
      - Addition of the replication origin to pg_last_committed_xact().
      
      The commit timestamp manager includes already APIs able to return the
      replication origin of a transaction on top of its commit timestamp, but
      the code paths for replication origins were never stressed as those
      functions have never looked for a replication origin, and the SQL
      functions available have never included this information since their
      introduction in 73c986ad.
      
      While on it, refactor a test of modules/commit_ts/ to use tstzrange() to
      check that a transaction timestamp is within the wanted range, making
      the test a bit easier to read.
      
      Bump catalog version.
      
      Author: Movead Li
      Reviewed-by: Madan Kumar, Michael Paquier
      Discussion: https://postgr.es/m/2020051116430836450630@highgo.ca
      b1e48bbe
  3. 11 Jul, 2020 6 commits
    • Tom Lane's avatar
      Avoid useless buffer allocations during binary COPY FROM. · cd22d3cd
      Tom Lane authored
      The raw_buf and line_buf buffers aren't used when reading binary format,
      so skip allocating them.  raw_buf is 64K so that seems like a worthwhile
      savings.  An unused line_buf only wastes 1K, but as long as we're checking
      it's free to avoid allocating that too.
      
      Bharath Rupireddy, tweaked a bit by me
      
      Discussion: https://postgr.es/m/CALj2ACXcCKaGPY0whowqrJ4OPJvDnTssgpGCzvuFQu5z0CXb-g@mail.gmail.com
      cd22d3cd
    • Tom Lane's avatar
      Avoid trying to restore table ACLs and per-column ACLs in parallel. · ea912530
      Tom Lane authored
      Parallel pg_restore has always supposed that ACL items for different
      objects are independent and can be restored in parallel without
      conflicts.  However, there is one case where this fails: because
      REVOKE on a table is defined to also revoke the privilege(s) at
      column level, we can't restore per-column ACLs till after we restore
      any table-level privileges on their table.  Failure to honor this
      restriction can lead to "tuple concurrently updated" errors during
      parallel restore, or even to the per-column ACLs silently disappearing
      because the table-level REVOKE is executed afterwards.
      
      To fix, add a dependency from each column-level ACL item to its table's
      ACL item, if there is one.  Note that this doesn't fix the hazard
      for pre-existing archive files, only for ones made with a corrected
      pg_dump.  Given that the bug's been there quite awhile without
      field reports, I think this is acceptable.
      
      This requires changing the API of pg_dump's dumpACL() function.
      To keep its argument list from getting even longer, I removed the
      "CatalogId objCatId" argument, which has been unused for ages.
      
      Per report from Justin Pryzby.  Back-patch to all supported branches.
      
      Discussion: https://postgr.es/m/20200706050129.GW4107@telsasoft.com
      ea912530
    • Peter Eisentraut's avatar
    • Michael Paquier's avatar
      Rename field "relkind" to "objtype" for CTAS and ALTER TABLE nodes · cc35d893
      Michael Paquier authored
      "relkind" normally refers to the char field from pg_class.  However, in
      the parse nodes AlterTableStmt and CreateTableAsStmt, "relkind" was used
      for a field of type enum ObjectType, that could refer to other object
      types than those possible for a relkind.  Such fields being usually
      named "objtype", switch the name in both structures to make things more
      consistent.  Note that this led to some confusion in functions that
      also operate on a RangeTableEntry object, which also has a field named
      "relkind".
      
      This naming goes back to commit 09d4e96d, where only OBJECT_TABLE and
      OBJECT_INDEX were used.  This got extended later to use as well
      OBJECT_TYPE with e440e12c, not really a relation kind.
      
      Author: Mark Dilger
      Reviewed-by: Daniel Gustafsson, Álvaro Herrera, Michael Paquier
      Discussion: https://postgr.es/m/609181AE-E399-47C7-9221-856E0F96BF93@enterprisedb.com
      cc35d893
    • Alexander Korotkov's avatar
      Forbid numeric NaN in jsonpath · df646509
      Alexander Korotkov authored
      SQL standard doesn't define numeric Inf or NaN values.  It appears even more
      ridiculous to support then in jsonpath assuming JSON doesn't support these
      values as well.  This commit forbids returning NaN from .double(), which was
      previously allowed.  NaN can't be result of inner-jsonpath computation over
      non-NaNs.  So, we can not expect NaN in the jsonpath output.
      
      Reported-by: Tom Lane
      Discussion: https://postgr.es/m/203949.1591879542%40sss.pgh.pa.us
      Author: Alexander Korotkov
      Reviewed-by: Tom Lane
      Backpatch-through: 12
      df646509
    • Alexander Korotkov's avatar
      Improve error reporting for jsonpath .double() method · 06571811
      Alexander Korotkov authored
      When jsonpath .double() method detects that numeric or string can't be
      converted to double precision, it throws an error.  This commit makes these
      errors explicitly express the reason of failure.
      
      Discussion: https://postgr.es/m/CAPpHfdtqJtiSXkP7tOXez18NxhLUH_-75bL8%3DOce4Ki%2Bbv7V6Q%40mail.gmail.com
      Author: Alexander Korotkov
      Reviewed-by: Tom Lane
      Backpatch-through: 12
      06571811
  4. 10 Jul, 2020 5 commits
  5. 09 Jul, 2020 5 commits
  6. 08 Jul, 2020 15 commits
  7. 07 Jul, 2020 5 commits
    • Tom Lane's avatar
      Un-break pg_upgrade from pre-v12 servers. · 3f96af46
      Tom Lane authored
      I neglected to test this scenario while preparing commit f3faf35f,
      so of course it was broken, thanks to some very obscure and undocumented
      code in pg_dump.  Pre-v12 databases might have toast tables attached to
      partitioned tables, which we need to ignore since newer servers never
      create such useless toast tables.  There was a filter for this case in
      binary_upgrade_set_type_oids_by_rel_oid(), which appeared to just
      prevent the pg_type OID from being copied.  But actually it managed to
      prevent the toast table from being created at all --- or it did before
      I took out that logic.  But that was a fundamentally bizarre place to be
      making the test in the first place.  The place where the filter should
      have been, one would think, is binary_upgrade_set_pg_class_oids(), so
      add it there.
      
      While at it, reorganize binary_upgrade_set_pg_class_oids() so that it
      doesn't make a completely useless query when it knows it's being
      invoked for an index.  And correct a comment that mis-described the
      scenario where we need to force creation of a TOAST table.
      
      Per buildfarm.
      3f96af46
    • Tom Lane's avatar
      Don't create pg_type entries for sequences or toast tables. · f3faf35f
      Tom Lane authored
      Commit f7f70d5e left one inconsistency behind: we're still creating
      pg_type entries for the composite types of sequences and toast tables,
      but not arrays over those composites.  But there seems precious little
      reason to have named composite types for toast tables, and not much more
      to have them for sequences (especially given the thought that sequences
      may someday not be standalone relations at all).
      
      So, let's close that inconsistency by removing these composite types,
      rather than adding arrays for them.  This buys back a little bit of
      the initial pg_type bloat added by the previous patch, and could be
      a significant savings in a large database with many toast tables.
      
      Aside from a small logic rearrangement in heap_create_with_catalog,
      this patch mostly needs to clean up some places that were assuming that
      pg_class.reltype always has a valid value.  Those are really pre-existing
      bugs, given that it's documented otherwise; notably, the plpgsql changes
      fix code that gives "cache lookup failed for type 0" on indexes today.
      But none of these seem interesting enough to back-patch.
      
      Also, remove the pg_dump/pg_upgrade infrastructure for propagating
      a toast table's pg_type OID into the new database, since we no longer
      need that.
      
      Discussion: https://postgr.es/m/761F1389-C6A8-4C15-80CE-950C961F5341@gmail.com
      f3faf35f
    • Alvaro Herrera's avatar
      Morph pg_replication_slots.min_safe_lsn to safe_wal_size · a8aaa0c7
      Alvaro Herrera authored
      The previous definition of the column was almost universally disliked,
      so provide this updated definition which is more useful for monitoring
      purposes: a large positive value is good, while zero or a negative value
      means danger.  This should be operationally more convenient.
      
      Backpatch to 13, where the new column to pg_replication_slots (and the
      feature it represents) were added.
      
      Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
      Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
      Reported-by: default avatarFujii Masao <masao.fujii@oss.nttdata.com>
      Discussion: https://postgr.es/m/9ddfbf8c-2f67-904d-44ed-cf8bc5916228@oss.nttdata.com
      a8aaa0c7
    • Magnus Hagander's avatar
      Check ssl_in_use flag when reporting statistics · 6a5c750f
      Magnus Hagander authored
      Previously we checked that the ssl pointer was not null, but this puts a
      requirement on there being such a pointer which may not be true in
      future multi-ssl-library supporting times. This seems to have been an
      oversight in 9029f4b3, but hasn't really had any effect since we only
      have one library.
      
      Author: Daniel Gustafsson
      6a5c750f
    • Peter Eisentraut's avatar
      71ec58e7
  8. 06 Jul, 2020 1 commit
    • Peter Geoghegan's avatar
      Remove unnecessary PageIsEmpty() nbtree build check. · 28c16f49
      Peter Geoghegan authored
      nbtree index builds cannot write out an empty page.  That would mean
      that there was no way to create a pivot tuple pointing to the page one
      level up, since _bt_truncate() generates one based on page's firstright
      tuple.
      
      Replace the unnecessary PageIsEmpty() check with an assertion that
      checks that the page has space for at least two line pointers (the
      would-be high key line pointer, plus at least one valid "data item"
      tuple line pointer).
      
      The PageIsEmpty() check was added by commit 5d9f146c over 20 years ago.
      It looks like it has always been unnecessary.
      28c16f49