1. 06 May, 2021 12 commits
  2. 05 May, 2021 4 commits
    • Alvaro Herrera's avatar
      Remove unused argument of ATAddForeignConstraint · c250062d
      Alvaro Herrera authored
      Commit 0325d7a5 made this unused but forgot to remove it. Do so now.
      
      Author: Amit Langote <amitlangote09@gmail.com>
      Discussion: https://postgr.es/m/209c99fe-b9a2-94f4-cd68-a8304186a09e@lab.ntt.co.jp
      c250062d
    • Alvaro Herrera's avatar
      Have ALTER CONSTRAINT recurse on partitioned tables · 6f70d7ca
      Alvaro Herrera authored
      When ALTER TABLE .. ALTER CONSTRAINT changes deferrability properties
      changed in a partitioned table, we failed to propagate those changes
      correctly to partitions and to triggers.  Repair by adding a recursion
      mechanism to affect all derived constraints and all derived triggers.
      (In particular, recurse to partitions even if their respective parents
      are already in the desired state: it is possible for the partitions to
      have been altered individually.)  Because foreign keys involve tables in
      two sides, we cannot use the standard ALTER TABLE recursion mechanism,
      so we invent our own by following pg_constraint.conparentid down.
      
      When ALTER TABLE .. ALTER CONSTRAINT is invoked on the derived
      pg_constraint object that's automaticaly created in a partition as a
      result of a constraint added to its parent, raise an error instead of
      pretending to work and then failing to modify all the affected triggers.
      Before this commit such a command would be allowed but failed to affect
      all triggers, so it would silently misbehave.  (Restoring dumps of
      existing databases is not affected, because pg_dump does not produce
      anything for such a derived constraint anyway.)
      
      Add some tests for the case.
      
      Backpatch to 11, where foreign key support was added to partitioned
      tables by commit 3de241db.  (A related change is commit f56f8f8d
      in pg12 which added support for FKs *referencing* partitioned tables;
      this is what forces us to use an ad-hoc recursion mechanism for this.)
      
      Diagnosed by Tom Lane from bug report from Ron L Johnson.  As of this
      writing, no reviews were offered.
      
      Discussion: https://postgr.es/m/75fe0761-a291-86a9-c8d8-4906da077469@gmail.com
      Discussion: https://postgr.es/m/3144850.1607369633@sss.pgh.pa.us
      6f70d7ca
    • Tom Lane's avatar
      Doc: improve and centralize the documentation for OID alias types. · f33a178a
      Tom Lane authored
      Previously, a lot of information about type regclass existed only
      in the discussion of the sequence functions.  Maybe that made sense
      in the beginning, because I think originally those were the only
      functions taking regclass.  But it doesn't make sense anymore.
      Move that material to the "Object Identifier Types" section in
      datatype.sgml, generalize it to talk about the other reg* types
      as well, and add more examples.
      
      Per bug #16991 from Federico Caselli.
      
      Discussion: https://postgr.es/m/16991-bcaeaafa17e0a723@postgresql.org
      f33a178a
    • Peter Eisentraut's avatar
      38f36aad
  3. 04 May, 2021 6 commits
  4. 03 May, 2021 10 commits
  5. 01 May, 2021 1 commit
  6. 30 Apr, 2021 6 commits
    • Tom Lane's avatar
      Doc: add an example of a self-referential foreign key to ddl.sgml. · e6f9539d
      Tom Lane authored
      While we've always allowed such cases, the documentation didn't
      say you could do it.
      
      Discussion: https://postgr.es/m/161969805833.690.13680986983883602407@wrigleys.postgresql.org
      e6f9539d
    • Tom Lane's avatar
      Doc: update libpq's documentation for PQfn(). · 386e64ea
      Tom Lane authored
      Mention specifically that you can't call aggregates, window functions,
      or procedures this way (the inability to call SRFs was already
      mentioned).
      
      Also, the claim that PQfn doesn't support NULL arguments or results
      has been a lie since we invented protocol 3.0.  Not sure why this
      text was never updated for that, but do it now.
      
      Discussion: https://postgr.es/m/2039442.1615317309@sss.pgh.pa.us
      386e64ea
    • Tom Lane's avatar
      Disallow calling anything but plain functions via the fastpath API. · 2efcd502
      Tom Lane authored
      Reject aggregates, window functions, and procedures.  Aggregates
      failed anyway, though with a somewhat obscure error message.
      Window functions would hit an Assert or null-pointer dereference.
      Procedures seemed to work as long as you didn't try to do
      transaction control, but (a) transaction control is sort of the
      point of a procedure, and (b) it's not entirely clear that no
      bugs lurk in that path.  Given the lack of testing of this area,
      it seems safest to be conservative in what we support.
      
      Also reject proretset functions, as the fastpath protocol can't
      support returning a set.
      
      Also remove an easily-triggered assertion that the given OID
      isn't 0; the subsequent lookups can handle that case themselves.
      
      Per report from Theodor-Arsenij Larionov-Trichkin.
      Back-patch to all supported branches.  (The procedure angle
      only applies in v11+, of course.)
      
      Discussion: https://postgr.es/m/2039442.1615317309@sss.pgh.pa.us
      2efcd502
    • Amit Kapila's avatar
      Fix the bugs in selecting the transaction for streaming. · ee4ba01d
      Amit Kapila authored
      There were two problems:
      a. We were always selecting the next available txn instead of selecting it
      when it is larger than the previous transaction.
      b. We were selecting the transactions which haven't made any changes to
      the database (base snapshot is not set). Later it was hitting an Assert
      because we don't decode such transactions and the changes in txn remain as
      it is. It is better not to choose such transactions for streaming in the
      first place.
      
      Reported-by: Haiying Tang
      Author: Dilip Kumar
      Reviewed-by: Amit Kapila
      Discussion: https://postgr.es/m/OS0PR01MB61133B94E63177040F7ECDA1FB429@OS0PR01MB6113.jpnprd01.prod.outlook.com
      ee4ba01d
    • David Rowley's avatar
      Adjust EXPLAIN output for parallel Result Cache plans · 3c80e96d
      David Rowley authored
      Here we adjust the EXPLAIN ANALYZE output for Result Cache so that we
      don't show any Result Cache stats for parallel workers who don't
      contribute anything to Result Cache plan nodes.
      
      I originally had ideas that workers who don't help could still have their
      Result Cache stats displayed.  The idea with that was so that I could
      write some parallel Result Cache regression tests that show the EXPLAIN
      ANALYZE output.  However, I realized a little too late that such tests
      would just not be possible to have run in a stable way on the buildfarm.
      
      With that knowledge, before 9eacee2e went in, I had removed all of the
      tests that were showing the EXPLAIN ANALYZE output of a parallel Result
      Cache plan, however, I forgot to put back the code that adjusts the
      EXPLAIN output to hide the Result Cache stats for parallel workers who
      were not fast enough to help out before query execution was over. All
      other nodes behave this way and so should Result Cache.
      
      Additionally, with this change, it now seems safe enough to remove the SET
      force_parallel_mode = off that I had added to the regression tests.
      
      Also, perform some cleanup in the partition_prune tests. I had adjusted
      the explain_parallel_append() function to sanitize the Result Cache
      EXPLAIN ANALYZE output.  However, since I didn't actually include any
      parallel Result Cache tests that show their EXPLAIN ANALYZE output, that
      code does nothing and can be removed.
      
      In passing, move the setting of memPeakKb into the scope where it's used.
      
      Reported-by: Amit Khandekar
      Author: David Rowley, Amit Khandekar
      Discussion: https://postgr.es/m/CAJ3gD9d8SkfY95GpM1zmsOtX2-Ogx5q-WLsf8f0ykEb0hCRK3w@mail.gmail.com
      3c80e96d
    • Amit Kapila's avatar
      Another try to fix the test case added by commit f5fc2f5b. · 51ef9173
      Amit Kapila authored
      As per analysis, it appears that the 'drop slot' message from the previous
      test and 'create slot' message of the new test are either missed or not
      yet delivered to the stats collector due to which we will still see the
      stats from the old slot. This can happen rarely which could be the reason
      that we are seeing some failures in the buildfarm randomly. To avoid that
      we are using a different slot name for the tests in
      test_decoding/sql/stats.sql.
      
      Reported-by: Tom Lane based on buildfarm reports
      Author: Sawada Masahiko
      Reviewed-by: Amit Kapila, Vignesh C
      Discussion: https://postgr.es/m/20210319185247.ldebgpdaxsowiflw@alap3.anarazel.de
      51ef9173
  7. 29 Apr, 2021 1 commit