pgsql: Fix relation descriptor leak.

2021-01-11 Thread Amit Kapila
Fix relation descriptor leak. We missed closing the relation descriptor while sending changes via the root of partitioned relations during logical replication. Author: Amit Langote and Mark Zhao Reviewed-by: Amit Kapila and Ashutosh Bapat Backpatch-through: 13, where it was introduced Discussion:

pgsql: Fix relation descriptor leak.

2021-01-11 Thread Amit Kapila
Fix relation descriptor leak. We missed closing the relation descriptor while sending changes via the root of partitioned relations during logical replication. Author: Amit Langote and Mark Zhao Reviewed-by: Amit Kapila and Ashutosh Bapat Backpatch-through: 13, where it was introduced Discussion:

pgsql: Optimize DropRelFileNodeBuffers() for recovery.

2021-01-11 Thread Amit Kapila
Optimize DropRelFileNodeBuffers() for recovery. The recovery path of DropRelFileNodeBuffers() is optimized so that scanning of the whole buffer pool can be avoided when the number of blocks to be truncated in a relation is below a certain threshold. For such cases, we find the buffers by doing loo

pgsql: Make pg_dump's table of object-type priorities more maintainable

2021-01-11 Thread Tom Lane
Make pg_dump's table of object-type priorities more maintainable. Wedging a new object type into this table has historically required manually renumbering a lot of existing entries. (Although it appears that some people got lazy and re-used the priority level of an existing object type, even if i

pgsql: Dump ALTER TABLE ... ATTACH PARTITION as a separate ArchiveEntry

2021-01-11 Thread Tom Lane
Dump ALTER TABLE ... ATTACH PARTITION as a separate ArchiveEntry. Previously, we emitted the ATTACH PARTITION command as part of the child table's ArchiveEntry. This was a poor choice since it complicates restoring the partition as a standalone table; you have to ignore the error from the ATTACH,

pgsql: Fix function prototypes in dependency.h.

2021-01-11 Thread Thomas Munro
Fix function prototypes in dependency.h. Commit 257836a7 accidentally deleted a couple of redundant-but-conventional "extern" keywords on function prototypes. Put them back. Reported-by: Alvaro Herrera Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/f315205f3fafd6

Re: pgsql: Track collation versions for indexes.

2021-01-11 Thread Thomas Munro
On Tue, Jan 12, 2021 at 10:37 AM Alvaro Herrera wrote: > This was a strange change ... Is this just an inadvertent slip-up? > -extern long changeDependenciesOf(Oid classId, Oid oldObjectId, > +long changeDependenciesOf(Oid classId, Oid oldObjectId, Huh, definitely not done on purpose. Will fix.

Re: pgsql: Track collation versions for indexes.

2021-01-11 Thread Alvaro Herrera
On 2020-Nov-02, Thomas Munro wrote: > Track collation versions for indexes. > src/include/catalog/dependency.h | 25 ++- This was a strange change ... Is this just an inadvertent slip-up? diff --git a/src/include/catalog/dependency.h b/src/include/catalog/dependency.h index 3baa5e

pgsql: Rethink SQLSTATE code for ERRCODE_IDLE_SESSION_TIMEOUT.

2021-01-11 Thread Tom Lane
Rethink SQLSTATE code for ERRCODE_IDLE_SESSION_TIMEOUT. Move it to class 57 (Operator Intervention), which seems like a better choice given that from the client's standpoint it behaves a heck of a lot like, e.g., ERRCODE_ADMIN_SHUTDOWN. In a green field I'd put ERRCODE_IDLE_IN_TRANSACTION_SESSION

pgsql: Try next host after a "cannot connect now" failure.

2021-01-11 Thread Tom Lane
Try next host after a "cannot connect now" failure. If a server returns ERRCODE_CANNOT_CONNECT_NOW, try the next host, if multiple host names have been provided. This allows dealing gracefully with standby servers that might not be in hot standby mode yet. In the wake of the preceding commit, it

pgsql: Allow pg_regress.c wrappers to postprocess test result files.

2021-01-11 Thread Tom Lane
Allow pg_regress.c wrappers to postprocess test result files. Add an optional callback to regression_main() that, if provided, is invoked on each test output file before we try to compare it to the expected-result file. The main and isolation test programs don't need this (yet). In pg_regress_ecp

pgsql: Uniformly identify the target host in libpq connection failure r

2021-01-11 Thread Tom Lane
Uniformly identify the target host in libpq connection failure reports. Prefix "could not connect to host-or-socket-path:" to all connection failure cases that occur after the socket() call, and remove the ad-hoc server identity data that was appended to a few of these messages. This should produ

pgsql: In libpq, always append new error messages to conn->errorMessage

2021-01-11 Thread Tom Lane
In libpq, always append new error messages to conn->errorMessage. Previously, we had an undisciplined mish-mash of printfPQExpBuffer and appendPQExpBuffer calls to report errors within libpq. This commit establishes a uniform rule that appendPQExpBuffer[Str] should be used. conn->errorMessage is