pgsql: Ignore generated columns during apply of update/delete.

2023-03-22 Thread Amit Kapila
Ignore generated columns during apply of update/delete. We fail to apply updates and deletes when the REPLICA IDENTITY FULL is used for the table having generated columns. We didn't use to ignore generated columns while doing tuple comparison among the tuples from the publisher and subscriber duri

pgsql: Ignore generated columns during apply of update/delete.

2023-03-22 Thread Amit Kapila
Ignore generated columns during apply of update/delete. We fail to apply updates and deletes when the REPLICA IDENTITY FULL is used for the table having generated columns. We didn't use to ignore generated columns while doing tuple comparison among the tuples from the publisher and subscriber duri

pgsql: Ignore generated columns during apply of update/delete.

2023-03-22 Thread Amit Kapila
Ignore generated columns during apply of update/delete. We fail to apply updates and deletes when the REPLICA IDENTITY FULL is used for the table having generated columns. We didn't use to ignore generated columns while doing tuple comparison among the tuples from the publisher and subscriber duri

pgsql: Ignore generated columns during apply of update/delete.

2023-03-22 Thread Amit Kapila
Ignore generated columns during apply of update/delete. We fail to apply updates and deletes when the REPLICA IDENTITY FULL is used for the table having generated columns. We didn't use to ignore generated columns while doing tuple comparison among the tuples from the publisher and subscriber duri

pgsql: Ignore generated columns during apply of update/delete.

2023-03-22 Thread Amit Kapila
Ignore generated columns during apply of update/delete. We fail to apply updates and deletes when the REPLICA IDENTITY FULL is used for the table having generated columns. We didn't use to ignore generated columns while doing tuple comparison among the tuples from the publisher and subscriber duri

pgsql: Allow logical replication to copy tables in binary format.

2023-03-22 Thread Amit Kapila
Allow logical replication to copy tables in binary format. This patch allows copying tables in the binary format during table synchronization when the binary option for a subscription is enabled. Previously, tables are copied in text format even if the subscription is created with the binary optio

pgsql: Improve a bit the tests of pg_walinspect

2023-03-22 Thread Michael Paquier
Improve a bit the tests of pg_walinspect This commit improves the tests of pg_walinspect on a few things: - Remove aggregates for queries that should fail. If the code is reworked in such a way that the behavior of these queries is changed, we would get more input from them, written this way. - E

pgsql: Improve the naming of Parallel Hash Join phases.

2023-03-22 Thread Thomas Munro
Improve the naming of Parallel Hash Join phases. * Commit 3048898e dropped -ING from PHJ wait event names. Update the corresponding barrier phases names to match. * Rename the "DONE" phases to "FREE". That's symmetrical with "ALLOCATE", and names the activity that actually happens in that p

pgsql: Evade extra table_tuple_fetch_row_version() in ExecUpdate()/Exec

2023-03-22 Thread Alexander Korotkov
Evade extra table_tuple_fetch_row_version() in ExecUpdate()/ExecDelete() When we lock tuple using table_tuple_lock() then we at the same time fetch the locked tuple to the slot. In this case we can skip extra table_tuple_fetch_row_version() thank to we've already fetched the 'old' tuple and nobod

pgsql: Allow locking updated tuples in tuple_update() and tuple_delete(

2023-03-22 Thread Alexander Korotkov
Allow locking updated tuples in tuple_update() and tuple_delete() Currently, in read committed transaction isolation mode (default), we have the following sequence of actions when tuple_update()/tuple_delete() finds the tuple updated by concurrent transaction. 1. Attempt to update/delete tuple wi

pgsql: Fix new test case to work on (some?) big-endian architectures.

2023-03-22 Thread Tom Lane
Fix new test case to work on (some?) big-endian architectures. Use of pack("L") gets around the basic endian problem, but it doesn't deal with the fact that the order of the bitfields within the struct may differ. This patch fixes it to work with gcc on NetBSD/macppc, but I wonder whether that wi

pgsql: Fix initdb's handling of min_wal_size and max_wal_size.

2023-03-22 Thread Tom Lane
Fix initdb's handling of min_wal_size and max_wal_size. In commit 3e51b278d, I misinterpreted the coding in setup_config() as setting min_wal_size and max_wal_size to compile-time-constant values. But it's not: there's a hidden dependency on --wal-segsize. Therefore leaving these variables commen

Re: pgsql: Teach verify_heapam() to validate update chains within a page.

2023-03-22 Thread Andres Freund
Hi, On 2023-03-22 13:05:49 -0700, Andres Freund wrote: > So either this very quickly bagged the first bugs, or there's something wrong > with the checks. I'll reply on the thread with a few more details / issues. https://postgr.es/m/CA%2BTgmoZub-bCg%3DORmbcCCbteQ2UQUc14T2GK%2Bv%2B6-VLd-8yK4g%40m

Re: pgsql: Teach verify_heapam() to validate update chains within a page.

2023-03-22 Thread Andres Freund
Hi, On 2023-03-22 15:33:15 -0400, Andrew Dunstan wrote: > On 2023-03-22 We 09:17, Robert Haas wrote: > > Teach verify_heapam() to validate update chains within a page. > > > > Prior to this commit, we only consider each tuple or line pointer > > on the page in isolation, but now we can do some va

Re: pgsql: Teach verify_heapam() to validate update chains within a page.

2023-03-22 Thread Andrew Dunstan
On 2023-03-22 We 09:17, Robert Haas wrote: Teach verify_heapam() to validate update chains within a page. Prior to this commit, we only consider each tuple or line pointer on the page in isolation, but now we can do some validation of a line pointer against its successor. For example, a redirec

pgsql: Reduce memory leakage in initdb.

2023-03-22 Thread Tom Lane
Reduce memory leakage in initdb. While testing commit 3e51b278d, I noted that initdb leaks about a megabyte worth of data due to the sloppy bookkeeping in its string-manipulating code. That's not a huge amount on modern machines, but it's still kind of annoying, and it's easy to fix by recognizin

pgsql: Add "-c name=value" switch to initdb.

2023-03-22 Thread Tom Lane
Add "-c name=value" switch to initdb. This option, or its long form --set, sets the GUC "name" to "value". The setting applies in the bootstrap and standalone servers run by initdb, and is also written into the generated postgresql.conf. This can save an extra editing step when creating a new clu

pgsql: Fix memory leak and inefficiency in CREATE DATABASE ... STRATEGY

2023-03-22 Thread Andres Freund
Fix memory leak and inefficiency in CREATE DATABASE ... STRATEGY WAL_LOG RelationCopyStorageUsingBuffer() did not free the strategies used to access the source / target relation. They memory was released at the end of the transaction, but when using a template database with a lot of relations, the

pgsql: Fix memory leak and inefficiency in CREATE DATABASE ... STRATEGY

2023-03-22 Thread Andres Freund
Fix memory leak and inefficiency in CREATE DATABASE ... STRATEGY WAL_LOG RelationCopyStorageUsingBuffer() did not free the strategies used to access the source / target relation. They memory was released at the end of the transaction, but when using a template database with a lot of relations, the

pgsql: Teach verify_heapam() to validate update chains within a page.

2023-03-22 Thread Robert Haas
Teach verify_heapam() to validate update chains within a page. Prior to this commit, we only consider each tuple or line pointer on the page in isolation, but now we can do some validation of a line pointer against its successor. For example, a redirect line pointer shouldn't point to another redi

pgsql: doc: Add description of some missing monitoring functions

2023-03-22 Thread Michael Paquier
doc: Add description of some missing monitoring functions This commit adds some documentation about two monitoring functions: - pg_stat_get_xact_blocks_fetched() - pg_stat_get_xact_blocks_hit() The description of these functions has been removed in ddfc2d9, later simplified by 5f2b089, assuming t

pgsql: doc: Add description of some missing monitoring functions

2023-03-22 Thread Michael Paquier
doc: Add description of some missing monitoring functions This commit adds some documentation about two monitoring functions: - pg_stat_get_xact_blocks_fetched() - pg_stat_get_xact_blocks_hit() The description of these functions has been removed in ddfc2d9, later simplified by 5f2b089, assuming t

pgsql: doc: Add description of some missing monitoring functions

2023-03-22 Thread Michael Paquier
doc: Add description of some missing monitoring functions This commit adds some documentation about two monitoring functions: - pg_stat_get_xact_blocks_fetched() - pg_stat_get_xact_blocks_hit() The description of these functions has been removed in ddfc2d9, later simplified by 5f2b089, assuming t

pgsql: doc: Add description of some missing monitoring functions

2023-03-22 Thread Michael Paquier
doc: Add description of some missing monitoring functions This commit adds some documentation about two monitoring functions: - pg_stat_get_xact_blocks_fetched() - pg_stat_get_xact_blocks_hit() The description of these functions has been removed in ddfc2d9, later simplified by 5f2b089, assuming t

pgsql: doc: Add description of some missing monitoring functions

2023-03-22 Thread Michael Paquier
doc: Add description of some missing monitoring functions This commit adds some documentation about two monitoring functions: - pg_stat_get_xact_blocks_fetched() - pg_stat_get_xact_blocks_hit() The description of these functions has been removed in ddfc2d9, later simplified by 5f2b089, assuming t

pgsql: doc: Add description of some missing monitoring functions

2023-03-22 Thread Michael Paquier
doc: Add description of some missing monitoring functions This commit adds some documentation about two monitoring functions: - pg_stat_get_xact_blocks_fetched() - pg_stat_get_xact_blocks_hit() The description of these functions has been removed in ddfc2d9, later simplified by 5f2b089, assuming t