Re: pgsql: BRIN: mask BRIN_EVACUATE_PAGE for WAL consistency checking

2022-08-06 Thread Álvaro Herrera
On Sat, Aug 6, 2022, at 9:01 PM, Tom Lane wrote: > snapper doesn't like this too much, because > > error running SQL: 'psql::17: ERROR: time zone "america/punta_arenas" > not recognized > CONTEXT: PL/pgSQL function inline_code_block line 3 during statement block > local variable initialization

Re: pgsql: BRIN: mask BRIN_EVACUATE_PAGE for WAL consistency checking

2022-08-07 Thread Álvaro Herrera
On 2022-Aug-06, Álvaro Herrera wrote: > On Sat, Aug 6, 2022, at 9:01 PM, Tom Lane wrote: > > snapper doesn't like this too much, because > > > > error running SQL: 'psql::17: ERROR: time zone > > "america/punta_arenas" not recognized > >

pgsql: Use deconstruct_array_builtin instead of deconstruct_array

2024-10-11 Thread Álvaro Herrera
Use deconstruct_array_builtin instead of deconstruct_array Commit 062a84442424 introduced use of deconstruct_array when deconstruct_array_builtin can be used instead. Do that to save some code. Author: Bertrand Drouvot Discussion: https://postgr.es/m/zwi5g2gzlux1n...@ip-10-97-1-34.eu-west-3.co

pgsql: Note that index_name in ALTER INDEX ATTACH PARTITION can be sche

2024-10-20 Thread Álvaro Herrera
Note that index_name in ALTER INDEX ATTACH PARTITION can be schema-qualified Missed in 8b08f7d4820f; backpatch to all supported branches. Reported-by: alv...@datadoghq.com Reviewed-by: Tom Lane Discussion: https://postgr.es/m/172924785099.698.15236991344616673...@wrigleys.postgresql.org Branch

pgsql: Note that index_name in ALTER INDEX ATTACH PARTITION can be sche

2024-10-20 Thread Álvaro Herrera
Note that index_name in ALTER INDEX ATTACH PARTITION can be schema-qualified Missed in 8b08f7d4820f; backpatch to all supported branches. Reported-by: alv...@datadoghq.com Reviewed-by: Tom Lane Discussion: https://postgr.es/m/172924785099.698.15236991344616673...@wrigleys.postgresql.org Branch

pgsql: Note that index_name in ALTER INDEX ATTACH PARTITION can be sche

2024-10-20 Thread Álvaro Herrera
Note that index_name in ALTER INDEX ATTACH PARTITION can be schema-qualified Missed in 8b08f7d4820f; backpatch to all supported branches. Reported-by: alv...@datadoghq.com Reviewed-by: Tom Lane Discussion: https://postgr.es/m/172924785099.698.15236991344616673...@wrigleys.postgresql.org Branch

pgsql: Note that index_name in ALTER INDEX ATTACH PARTITION can be sche

2024-10-20 Thread Álvaro Herrera
Note that index_name in ALTER INDEX ATTACH PARTITION can be schema-qualified Missed in 8b08f7d4820f; backpatch to all supported branches. Reported-by: alv...@datadoghq.com Reviewed-by: Tom Lane Discussion: https://postgr.es/m/172924785099.698.15236991344616673...@wrigleys.postgresql.org Branch

pgsql: Note that index_name in ALTER INDEX ATTACH PARTITION can be sche

2024-10-20 Thread Álvaro Herrera
Note that index_name in ALTER INDEX ATTACH PARTITION can be schema-qualified Missed in 8b08f7d4820f; backpatch to all supported branches. Reported-by: alv...@datadoghq.com Reviewed-by: Tom Lane Discussion: https://postgr.es/m/172924785099.698.15236991344616673...@wrigleys.postgresql.org Branch

pgsql: Note that index_name in ALTER INDEX ATTACH PARTITION can be sche

2024-10-20 Thread Álvaro Herrera
Note that index_name in ALTER INDEX ATTACH PARTITION can be schema-qualified Missed in 8b08f7d4820f; backpatch to all supported branches. Reported-by: alv...@datadoghq.com Reviewed-by: Tom Lane Discussion: https://postgr.es/m/172924785099.698.15236991344616673...@wrigleys.postgresql.org Branch

pgsql: Note that index_name in ALTER INDEX ATTACH PARTITION can be sche

2024-10-20 Thread Álvaro Herrera
Note that index_name in ALTER INDEX ATTACH PARTITION can be schema-qualified Missed in 8b08f7d4820f; backpatch to all supported branches. Reported-by: alv...@datadoghq.com Reviewed-by: Tom Lane Discussion: https://postgr.es/m/172924785099.698.15236991344616673...@wrigleys.postgresql.org Branch

pgsql: Restructure foreign key handling code for ATTACH/DETACH

2024-10-22 Thread Álvaro Herrera
Restructure foreign key handling code for ATTACH/DETACH ... to fix bugs when the referenced table is partitioned. The catalog representation we chose for foreign keys connecting partitioned tables (in commit f56f8f8da6af) is inconvenient, in the sense that a standalone table has a different way t

pgsql: Restructure foreign key handling code for ATTACH/DETACH

2024-10-22 Thread Álvaro Herrera
Restructure foreign key handling code for ATTACH/DETACH ... to fix bugs when the referenced table is partitioned. The catalog representation we chose for foreign keys connecting partitioned tables (in commit f56f8f8da6af) is inconvenient, in the sense that a standalone table has a different way t

pgsql: Restructure foreign key handling code for ATTACH/DETACH

2024-10-22 Thread Álvaro Herrera
Restructure foreign key handling code for ATTACH/DETACH ... to fix bugs when the referenced table is partitioned. The catalog representation we chose for foreign keys connecting partitioned tables (in commit f56f8f8da6af) is inconvenient, in the sense that a standalone table has a different way t

pgsql: Restructure foreign key handling code for ATTACH/DETACH

2024-10-22 Thread Álvaro Herrera
Restructure foreign key handling code for ATTACH/DETACH ... to fix bugs when the referenced table is partitioned. The catalog representation we chose for foreign keys connecting partitioned tables (in commit f56f8f8da6af) is inconvenient, in the sense that a standalone table has a different way t

pgsql: Restructure foreign key handling code for ATTACH/DETACH

2024-10-22 Thread Álvaro Herrera
Restructure foreign key handling code for ATTACH/DETACH ... to fix bugs when the referenced table is partitioned. The catalog representation we chose for foreign keys connecting partitioned tables (in commit f56f8f8da6af) is inconvenient, in the sense that a standalone table has a different way t

pgsql: Restructure foreign key handling code for ATTACH/DETACH

2024-10-22 Thread Álvaro Herrera
Restructure foreign key handling code for ATTACH/DETACH ... to fix bugs when the referenced table is partitioned. The catalog representation we chose for foreign keys connecting partitioned tables (in commit f56f8f8da6af) is inconvenient, in the sense that a standalone table has a different way t

pgsql: Fix some more bugs in foreign keys connecting partitioned tables

2024-10-30 Thread Álvaro Herrera
Fix some more bugs in foreign keys connecting partitioned tables * In DetachPartitionFinalize() we were applying a tuple conversion map to tuples that didn't need one, which can lead to erratic behavior if a partitioned table has a partition with a different column order, as reported by Alex

pgsql: Fix some more bugs in foreign keys connecting partitioned tables

2024-10-30 Thread Álvaro Herrera
Fix some more bugs in foreign keys connecting partitioned tables * In DetachPartitionFinalize() we were applying a tuple conversion map to tuples that didn't need one, which can lead to erratic behavior if a partitioned table has a partition with a different column order, as reported by Alex

pgsql: Fix some more bugs in foreign keys connecting partitioned tables

2024-10-30 Thread Álvaro Herrera
Fix some more bugs in foreign keys connecting partitioned tables * In DetachPartitionFinalize() we were applying a tuple conversion map to tuples that didn't need one, which can lead to erratic behavior if a partitioned table has a partition with a different column order, as reported by Alex

pgsql: Fix some more bugs in foreign keys connecting partitioned tables

2024-10-30 Thread Álvaro Herrera
Fix some more bugs in foreign keys connecting partitioned tables * In DetachPartitionFinalize() we were applying a tuple conversion map to tuples that didn't need one, which can lead to erratic behavior if a partitioned table has a partition with a different column order, as reported by Alex

pgsql: Fix pg_upgrade's cross-version tests when old < 18

2024-11-13 Thread Álvaro Herrera
Fix pg_upgrade's cross-version tests when old < 18 Because in the 18 cycle we turned checksums on by default with commit 04bec894a04c, and pg_upgrade fails if the setting doesn't match in old and new clusters, the built-in cross-version pg_upgrade test is failing if the old version is older than 1

pgsql: Silence compilers about extractNotNullColumn()

2024-11-12 Thread Álvaro Herrera
Silence compilers about extractNotNullColumn() Multiple buildfarm animals warn that a newly added Assert() is impossible to fail; remove it to avoid the noise. While at it, use direct assignment to obtain the value we need, avoiding an unnecessary memcpy(). (I decided to remove the "pfree" call

pgsql: doc: Reword ALTER TABLE ATTACH restriction on NO INHERIT constra

2024-11-07 Thread Álvaro Herrera
doc: Reword ALTER TABLE ATTACH restriction on NO INHERIT constraints The previous wording is easy to read incorrectly; this change makes it simpler, less ambiguous, and less prominent. Backpatch to all live branches. Reviewed-by: Amit Langote Discussion: https://postgr.es/m/202411051201.zody6ml

pgsql: doc: Reword ALTER TABLE ATTACH restriction on NO INHERIT constra

2024-11-07 Thread Álvaro Herrera
doc: Reword ALTER TABLE ATTACH restriction on NO INHERIT constraints The previous wording is easy to read incorrectly; this change makes it simpler, less ambiguous, and less prominent. Backpatch to all live branches. Reviewed-by: Amit Langote Discussion: https://postgr.es/m/202411051201.zody6ml

pgsql: doc: Reword ALTER TABLE ATTACH restriction on NO INHERIT constra

2024-11-07 Thread Álvaro Herrera
doc: Reword ALTER TABLE ATTACH restriction on NO INHERIT constraints The previous wording is easy to read incorrectly; this change makes it simpler, less ambiguous, and less prominent. Backpatch to all live branches. Reviewed-by: Amit Langote Discussion: https://postgr.es/m/202411051201.zody6ml

pgsql: doc: Reword ALTER TABLE ATTACH restriction on NO INHERIT constra

2024-11-07 Thread Álvaro Herrera
doc: Reword ALTER TABLE ATTACH restriction on NO INHERIT constraints The previous wording is easy to read incorrectly; this change makes it simpler, less ambiguous, and less prominent. Backpatch to all live branches. Reviewed-by: Amit Langote Discussion: https://postgr.es/m/202411051201.zody6ml

pgsql: doc: Reword ALTER TABLE ATTACH restriction on NO INHERIT constra

2024-11-07 Thread Álvaro Herrera
doc: Reword ALTER TABLE ATTACH restriction on NO INHERIT constraints The previous wording is easy to read incorrectly; this change makes it simpler, less ambiguous, and less prominent. Backpatch to all live branches. Reviewed-by: Amit Langote Discussion: https://postgr.es/m/202411051201.zody6ml

pgsql: doc: Reword ALTER TABLE ATTACH restriction on NO INHERIT constra

2024-11-07 Thread Álvaro Herrera
doc: Reword ALTER TABLE ATTACH restriction on NO INHERIT constraints The previous wording is easy to read incorrectly; this change makes it simpler, less ambiguous, and less prominent. Backpatch to all live branches. Reviewed-by: Amit Langote Discussion: https://postgr.es/m/202411051201.zody6ml

pgsql: Add pg_constraint rows for not-null constraints

2024-11-08 Thread Álvaro Herrera
dropped indirectly (e.g., via DROP COLUMN). Some bits of code in this patch were authored by Jian He. Author: Álvaro Herrera Author: Bernd Helmle Reviewed-by: 何建 (jian he) Reviewed-by: 王刚 (Tender Wang) Reviewed-by: Justin Pryzby Reviewed-by: Peter Eisentraut Reviewed-by: Dean Rasheed Discuss

pgsql: Fix newly introduced 010_keep_recycled_wals.pl

2024-11-21 Thread Álvaro Herrera
Fix newly introduced 010_keep_recycled_wals.pl It failed to set the archive_command as it desired because of a syntax problem. Oversight in commit 90bcc7c2db1d. This bug doesn't cause the test to fail, because the test only checks pg_rewind's output messages, not the actual outcome (and the outc

pgsql: Fix newly introduced 010_keep_recycled_wals.pl

2024-11-21 Thread Álvaro Herrera
Fix newly introduced 010_keep_recycled_wals.pl It failed to set the archive_command as it desired because of a syntax problem. Oversight in commit 90bcc7c2db1d. This bug doesn't cause the test to fail, because the test only checks pg_rewind's output messages, not the actual outcome (and the outc

pgsql: Fix newly introduced 010_keep_recycled_wals.pl

2024-11-21 Thread Álvaro Herrera
Fix newly introduced 010_keep_recycled_wals.pl It failed to set the archive_command as it desired because of a syntax problem. Oversight in commit 90bcc7c2db1d. This bug doesn't cause the test to fail, because the test only checks pg_rewind's output messages, not the actual outcome (and the outc

pgsql: Make GUC_check_errdetail messages full sentences

2024-11-27 Thread Álvaro Herrera
Make GUC_check_errdetail messages full sentences They were all missing punctuation, one was missing initial capital. Per our message style guidelines. No backpatch, to avoid breaking existing translations. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/6ba9892f5cb

pgsql: Remove redundant relam initialization

2024-11-27 Thread Álvaro Herrera
Remove redundant relam initialization This struct member is initialized again a few lines below in the same function. This is cosmetic, so no backpatch. Reported-by: Jingtang Zhang Discussion: https://postgr.es/m/aff74506-b925-46bb-b875-cf5a94617...@gmail.com Branch -- master Details

pgsql: Avoid deleting critical WAL segments during pg_rewind

2024-11-15 Thread Álvaro Herrera
Avoid deleting critical WAL segments during pg_rewind Previously, in unlucky cases, it was possible for pg_rewind to remove certain WAL segments from the rewound demoted primary. In particular this happens if those files have been marked for archival (i.e., their .ready files were created) but no

pgsql: Avoid deleting critical WAL segments during pg_rewind

2024-11-15 Thread Álvaro Herrera
Avoid deleting critical WAL segments during pg_rewind Previously, in unlucky cases, it was possible for pg_rewind to remove certain WAL segments from the rewound demoted primary. In particular this happens if those files have been marked for archival (i.e., their .ready files were created) but no

pgsql: Avoid deleting critical WAL segments during pg_rewind

2024-11-15 Thread Álvaro Herrera
Avoid deleting critical WAL segments during pg_rewind Previously, in unlucky cases, it was possible for pg_rewind to remove certain WAL segments from the rewound demoted primary. In particular this happens if those files have been marked for archival (i.e., their .ready files were created) but no

pgsql: Avoid deleting critical WAL segments during pg_rewind

2024-11-15 Thread Álvaro Herrera
Avoid deleting critical WAL segments during pg_rewind Previously, in unlucky cases, it was possible for pg_rewind to remove certain WAL segments from the rewound demoted primary. In particular this happens if those files have been marked for archival (i.e., their .ready files were created) but no

pgsql: Avoid deleting critical WAL segments during pg_rewind

2024-11-15 Thread Álvaro Herrera
Avoid deleting critical WAL segments during pg_rewind Previously, in unlucky cases, it was possible for pg_rewind to remove certain WAL segments from the rewound demoted primary. In particular this happens if those files have been marked for archival (i.e., their .ready files were created) but no

pgsql: Clean up newlines following left parentheses

2024-11-26 Thread Álvaro Herrera
Clean up newlines following left parentheses Most came in during the 17 cycle, so backpatch there. Some (particularly reorderbuffer.h) are very old, but backpatching doesn't seem useful. Like commits c9d297751959, c4f113e8fef9. Branch -- REL_17_STABLE Details --- https://git.postgresql

pgsql: Clean up newlines following left parentheses

2024-11-26 Thread Álvaro Herrera
Clean up newlines following left parentheses Most came in during the 17 cycle, so backpatch there. Some (particularly reorderbuffer.h) are very old, but backpatching doesn't seem useful. Like commits c9d297751959, c4f113e8fef9. Branch -- master Details --- https://git.postgresql.org/pg

pgsql: Fix pg_get_constraintdef for NOT NULL constraints on domains

2024-11-27 Thread Álvaro Herrera
Fix pg_get_constraintdef for NOT NULL constraints on domains We added pg_constraint rows for all not-null constraints, first for tables and later for domains; but while the ones for tables were reverted, the ones for domains were not. However, we did accidentally revert ruleutils.c support for th

pgsql: Fix pg_get_constraintdef for NOT NULL constraints on domains

2024-11-27 Thread Álvaro Herrera
Fix pg_get_constraintdef for NOT NULL constraints on domains We added pg_constraint rows for all not-null constraints, first for tables and later for domains; but while the ones for tables were reverted, the ones for domains were not. However, we did accidentally revert ruleutils.c support for th

pgsql: Drop "Lock" suffix from LWLock wait event names

2024-12-03 Thread Álvaro Herrera
Drop "Lock" suffix from LWLock wait event names Commit da952b415f44 unintentially reverted the SQL-visible part of commit 14a910109126, which breaks queries joining pg_wait_events with pg_stat_acivity. Remove the suffix again. Backpatch to 17. Reported-by: Christophe Courtois Author: Bertrand

pgsql: Drop "Lock" suffix from LWLock wait event names

2024-12-03 Thread Álvaro Herrera
Drop "Lock" suffix from LWLock wait event names Commit da952b415f44 unintentially reverted the SQL-visible part of commit 14a910109126, which breaks queries joining pg_wait_events with pg_stat_acivity. Remove the suffix again. Backpatch to 17. Reported-by: Christophe Courtois Author: Bertrand

pgsql: Update obsolete comment

2024-12-03 Thread Álvaro Herrera
Update obsolete comment Commit 3aa0395d4ed3 made worrying about BKI_ROWTYPE_OID matching no longer necessary, but this comment didn't get the memo. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/4cc2a449802ec654b1b3ac4db698c3af4e7fd9f7 Modified Files -

pgsql: Fix synchronized_standby_slots GUC check hook

2024-12-03 Thread Álvaro Herrera
Fix synchronized_standby_slots GUC check hook The validate_sync_standby_slots subroutine requires an LWLock, so it cannot run in processes without PGPROC; skip it there to avoid a crash. This replaces the current test for ReplicationSlotCtl being not null, which appears to be a solution for the s

pgsql: Fix synchronized_standby_slots GUC check hook

2024-12-03 Thread Álvaro Herrera
Fix synchronized_standby_slots GUC check hook The validate_sync_standby_slots subroutine requires an LWLock, so it cannot run in processes without PGPROC; skip it there to avoid a crash. This replaces the current test for ReplicationSlotCtl being not null, which appears to be a solution for the s

pgsql: Remove unnecessary code to handle CONSTR_NOTNULL

2025-01-07 Thread Álvaro Herrera
Remove unnecessary code to handle CONSTR_NOTNULL Commit 14e87ffa5c54 needlessly added support for CONSTR_NOTNULL entries to StoreConstraints. It's dead code, so remove it. To make the situation regarding constraint creation clearer, change comments in heap_create_with_catalog, StoreConstraints,

pgsql: Fix error message wording

2025-01-07 Thread Álvaro Herrera
Fix error message wording The originals are ambiguous and a bit out of style. Reviewed-by: Amit Langote Discussion: https://postgr.es/m/202412141243.efesjyyvzxsz@alvherre.pgsql Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/0e5b14410e2bb54d191bbb7bb21a674ccabe768

pgsql: Fix error message wording

2025-01-07 Thread Álvaro Herrera
Fix error message wording The originals are ambiguous and a bit out of style. Reviewed-by: Amit Langote Discussion: https://postgr.es/m/202412141243.efesjyyvzxsz@alvherre.pgsql Branch -- REL_17_STABLE Details --- https://git.postgresql.org/pg/commitdiff/d7905aa1da00115d56ca199b848bcc93

pgsql: Backpatch critical performance fixes to pgarch.c

2024-12-12 Thread Álvaro Herrera
Backpatch critical performance fixes to pgarch.c This backpatches commits beb4e9ba1652 and 1fb17b190341 (originally appearing in previously in REL_15_STABLE) to REL_14_STABLE. Performance of the WAL archiver can become pretty critical at times, and reports exist of users getting in serious troubl

pgsql: Refactor some SQL/JSON error messages

2024-12-14 Thread Álvaro Herrera
Refactor some SQL/JSON error messages Turn type names into "%s" specifiers to 1) avoid getting them translated and 2) reduce the total number of messages. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/62b7a9a7784eb8b3871368726fc3b8df17d87f32 Modified Files --

pgsql: Dump not-null constraints on inherited columns correctly

2024-12-12 Thread Álvaro Herrera
Dump not-null constraints on inherited columns correctly With not-null constraints defined in child tables for columns that are coming from their parent tables, we were printing ALTER TABLE SET NOT NULL commands that were missing the constraint name, so the original constraint name was being lost,

pgsql: Rewrite maybe_reread_subscription() comment

2024-12-12 Thread Álvaro Herrera
Rewrite maybe_reread_subscription() comment One sentence was gramatically wrong, but also too terse. Expand on it. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/3191eccd8a9bff1715f2e4fab86d2932a556185e Modified Files -- src/backend/replication/logica

pgsql: Fix outdated bit in README.tuplock

2024-11-21 Thread Álvaro Herrera
Fix outdated bit in README.tuplock Apparently this information has been outdated since first committed, because we adopted a different implementation during development per reviews and this detail was not updated in the README. This has been wrong since commit 0ac5ad5134f2 introduced the file in

pgsql: Fix outdated bit in README.tuplock

2024-11-21 Thread Álvaro Herrera
Fix outdated bit in README.tuplock Apparently this information has been outdated since first committed, because we adopted a different implementation during development per reviews and this detail was not updated in the README. This has been wrong since commit 0ac5ad5134f2 introduced the file in

pgsql: Fix outdated bit in README.tuplock

2024-11-21 Thread Álvaro Herrera
Fix outdated bit in README.tuplock Apparently this information has been outdated since first committed, because we adopted a different implementation during development per reviews and this detail was not updated in the README. This has been wrong since commit 0ac5ad5134f2 introduced the file in

pgsql: Fix outdated bit in README.tuplock

2024-11-21 Thread Álvaro Herrera
Fix outdated bit in README.tuplock Apparently this information has been outdated since first committed, because we adopted a different implementation during development per reviews and this detail was not updated in the README. This has been wrong since commit 0ac5ad5134f2 introduced the file in

pgsql: Fix outdated bit in README.tuplock

2024-11-21 Thread Álvaro Herrera
Fix outdated bit in README.tuplock Apparently this information has been outdated since first committed, because we adopted a different implementation during development per reviews and this detail was not updated in the README. This has been wrong since commit 0ac5ad5134f2 introduced the file in

pgsql: Unify repetitive error messages

2024-11-21 Thread Álvaro Herrera
Unify repetitive error messages Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/da94e871e8877d1f1054277b24b604bf1c0036a6 Modified Files -- src/backend/commands/explain.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)

pgsql: Fix outdated bit in README.tuplock

2024-11-21 Thread Álvaro Herrera
Fix outdated bit in README.tuplock Apparently this information has been outdated since first committed, because we adopted a different implementation during development per reviews and this detail was not updated in the README. This has been wrong since commit 0ac5ad5134f2 introduced the file in

pgsql: Fix newly introduced 010_keep_recycled_wals.pl

2024-11-21 Thread Álvaro Herrera
Fix newly introduced 010_keep_recycled_wals.pl It failed to set the archive_command as it desired because of a syntax problem. Oversight in commit 90bcc7c2db1d. This bug doesn't cause the test to fail, because the test only checks pg_rewind's output messages, not the actual outcome (and the outc

pgsql: Fix newly introduced 010_keep_recycled_wals.pl

2024-11-21 Thread Álvaro Herrera
Fix newly introduced 010_keep_recycled_wals.pl It failed to set the archive_command as it desired because of a syntax problem. Oversight in commit 90bcc7c2db1d. This bug doesn't cause the test to fail, because the test only checks pg_rewind's output messages, not the actual outcome (and the outc

pgsql: Fix SLRU bank selection code

2025-01-08 Thread Álvaro Herrera
Fix SLRU bank selection code The originally submitted code (using bit masking) was correct when the number of slots was restricted to be a power of two -- but that limitation was removed during development that led to commit 53c2a97a9266, which made the bank selection code incorrect. This led to

pgsql: Fix SLRU bank selection code

2025-01-08 Thread Álvaro Herrera
Fix SLRU bank selection code The originally submitted code (using bit masking) was correct when the number of slots was restricted to be a power of two -- but that limitation was removed during development that led to commit 53c2a97a9266, which made the bank selection code incorrect. This led to

pgsql: Reword recent error messages: "should" -> "must"

2025-01-21 Thread Álvaro Herrera
Reword recent error messages: "should" -> "must" Most were introduced in the 17 timeframe. The ones in wparser_def.c are very old. I also changed "JSON path expression for column \"%s\" should return single item without wrapper" to "JSON path expression for column \"%s\" must return single item

pgsql: Reword recent error messages: "should" -> "must"

2025-01-21 Thread Álvaro Herrera
Reword recent error messages: "should" -> "must" Most were introduced in the 17 timeframe. The ones in wparser_def.c are very old. I also changed "JSON path expression for column \"%s\" should return single item without wrapper" to "JSON path expression for column \"%s\" must return single item

pgsql: Allow NOT VALID foreign key constraints on partitioned tables

2025-01-23 Thread Álvaro Herrera
Allow NOT VALID foreign key constraints on partitioned tables This feature was intentionally omitted when FKs were first implemented for partitioned tables, and had been requested a few times; the usefulness is clear. Validation can happen for each partition individually, which is useful to conta

pgsql: Fix instability in recently added regression tests

2025-01-24 Thread Álvaro Herrera
Fix instability in recently added regression tests We missed the usual ORDER BY clause. Author: Amul Sul Discussion: https://postgr.es/m/caaj_b974u3vvf-qgwfyz73dfhqyfjp9tomuixr2kp8kvcjt...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/c44c2d27598

pgsql: Add missing CommandCounterIncrement

2025-01-26 Thread Álvaro Herrera
Add missing CommandCounterIncrement For commit b663b9436e75 I thought this was useless, but turns out not to be for the case where a partitioned table has two identical foreign key constraints which can both be matched by the same constraint in a partition during attach. This CCI makes the match

pgsql: Fix detach of a partition that has a toplevel FK to a partitione

2025-01-21 Thread Álvaro Herrera
Fix detach of a partition that has a toplevel FK to a partitioned table In common cases, foreign keys are defined on the toplevel partitioned table; but if instead one is defined on a partition and references a partitioned table, and the referencing partition is detached, we would examine the pg_c

pgsql: Fix detach of a partition that has a toplevel FK to a partitione

2025-01-21 Thread Álvaro Herrera
Fix detach of a partition that has a toplevel FK to a partitioned table In common cases, foreign keys are defined on the toplevel partitioned table; but if instead one is defined on a partition and references a partitioned table, and the referencing partition is detached, we would examine the pg_c

pgsql: Fix detach of a partition that has a toplevel FK to a partitione

2025-01-21 Thread Álvaro Herrera
Fix detach of a partition that has a toplevel FK to a partitioned table In common cases, foreign keys are defined on the toplevel partitioned table; but if instead one is defined on a partition and references a partitioned table, and the referencing partition is detached, we would examine the pg_c

pgsql: Fix detach of a partition that has a toplevel FK to a partitione

2025-01-21 Thread Álvaro Herrera
Fix detach of a partition that has a toplevel FK to a partitioned table In common cases, foreign keys are defined on the toplevel partitioned table; but if instead one is defined on a partition and references a partitioned table, and the referencing partition is detached, we would examine the pg_c

pgsql: Split ATExecValidateConstraint into reusable pieces

2025-01-16 Thread Álvaro Herrera
Split ATExecValidateConstraint into reusable pieces With this, we have separate functions to add validation requests to ALTER TABLE's phase 3 queue for check and foreign key constraints, which allows reusing them in future commits -- particularly this will allow us to perform validation of invalid

pgsql: Adjust signature of cluster_rel() and its subroutines

2025-01-10 Thread Álvaro Herrera
Adjust signature of cluster_rel() and its subroutines cluster_rel() receives the OID of the relation to process, which it opens and locks; but then its subroutine copy_table_data() also receives the relation OID and opens it by itself. This is a bit wasteful. It's better to have cluster_rel() re

pgsql: Simplify signature of RewriteTable

2025-01-09 Thread Álvaro Herrera
Simplify signature of RewriteTable This function doesn't need the lockmode to be passed: it was being used to lock the new heap, but that's bogus, because the only caller has already obtained the appropriate lock on the new heap (which is unimportant anyway, because the relation's creation is not

pgsql: Fix typo

2025-03-24 Thread Álvaro Herrera
Fix typo Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/0e3e0ec06b995f6809f315752cbf5ff67902e095 Modified Files -- src/test/authentication/t/001_password.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

pgsql: Simplify reindexdb coding

2025-03-18 Thread Álvaro Herrera
makes some comparisons easier, and we don't really need the names of the tables, just their OIDs. (This requires atooid, which requires ). Author: Ranier Vilela Author: Álvaro Herrera Discussion: https://postgr.es/m/CAEudQArfqr0-s0VVPSEh=0kgOgBJvFNdGW=xsl5rbcr0wdm...@mail.gmail.com Branc

pgsql: doc: Explain more thoroughly when a table rewrite is needed

2025-03-14 Thread Álvaro Herrera
doc: Explain more thoroughly when a table rewrite is needed Author: Masahiro Ikeda Reviewed-by: Robert Treat Discussion: https://postgr.es/m/00e6eb5f5c793b8ef722252c7a519...@oss.nttdata.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/11bd8318602fc2282a6201f714

pgsql: Remove direct handling of reloptions for toast tables

2025-03-14 Thread Álvaro Herrera
Remove direct handling of reloptions for toast tables It doesn't actually work, even with allow_system_table_mods turned on: the ALTER TABLE operation is rejected by ATSimplePermissions(), so even the error message we're adding in this commit is unreachable. Add a test case for it. Author: Nikol

pgsql: Introduce squashing of constant lists in query jumbling

2025-03-18 Thread Álvaro Herrera
-by: Sergey Dudoladov (mysterious, off-list) Reviewed-by: David Geier Reviewed-by: Robert Haas Reviewed-by: Álvaro Herrera Reviewed-by: Sami Imseih Reviewed-by: Sutou Kouhei Reviewed-by: Tom Lane Reviewed-by: Michael Paquier Reviewed-by: Marcos Pegoraro Reviewed-by: Julien Rouhaud Reviewed-by:

pgsql: Change one loop in ATRewriteTable to use 1-based attnums

2025-04-04 Thread Álvaro Herrera
Change one loop in ATRewriteTable to use 1-based attnums All TupleDescAttr() calls in tablecmds.c that aren't in loops across all attributes use AttrNumber-style indexes (1-based); there was only one place in ATRewriteTable that was stashing 0-based indexes in a list for later processing. Switch

pgsql: Add modern SHA-2 based password hashes to pgcrypto.

2025-04-05 Thread Álvaro Herrera
Add modern SHA-2 based password hashes to pgcrypto. This adapts the publicly available reference implementation on https://www.akkadia.org/drepper/SHA-crypt.txt and adds the new hash algorithms sha256crypt and sha512crypt to crypt() and gen_salt() respectively. Author: Bernd Helmle Reviewed-by:

pgsql: pg_dump: Tiny header cleanup

2025-04-05 Thread Álvaro Herrera
pg_dump: Tiny header cleanup In commits 9c02e3a986da and 8ec0aaeae094, Nathan added a duplicate TocEntry typedef forward declaration (plus assorted #ifdef hackery to avoid C99 preprocessor issues) to deal with some very old untidyness regarding DefnDumperPtr function prototype being located in pg_

pgsql: Set log_statement=none in t/002_pg_upgrade.pl

2025-04-05 Thread Álvaro Herrera
Set log_statement=none in t/002_pg_upgrade.pl This should make the test a wee bit faster on high-load machines (e.g., when running under valgrind). Per complaint from Andres Freund. Discussion: https://postgr.es/m/cwbcyjp2ts7o7xgy5y5gwtcd4zltvncsj67el7xgci7xbwrhlu@k363vk5tce4g Branch -- ma

pgsql: Simplify syntax for ALTER TABLE ALTER CONSTRAINT NO INHERIT

2025-03-27 Thread Álvaro Herrera
Simplify syntax for ALTER TABLE ALTER CONSTRAINT NO INHERIT Commit d45597f72fe5 introduced the ability to change a not-null constraint from NO INHERIT to INHERIT and vice versa, but we included the SET noise word in the syntax for it. The SET turns out not to be necessary and goes against what th

pgsql: Verify roundtrip dump/restore of regression database

2025-04-01 Thread Álvaro Herrera
we use --format=directory -j2. This test has already reported pg_dump bugs, as fixed in fd41ba93e463, 74563f6b9021, d611f8b1587b, 4694aedf63bf. Author: Ashutosh Bapat Reviewed-by: Michael Paquier Reviewed-by: Daniel Gustafsson Reviewed-by: Tom Lane Reviewed-by: Álvaro Herrera Dis

pgsql: Allow NOT NULL constraints to be added as NOT VALID

2025-04-07 Thread Álvaro Herrera
x27;t allow them to have pg_constraint rows anyway.) Author: Rushabh Lathia Author: Jian He Reviewed-by: Álvaro Herrera Tested-by: Ashutosh Bapat Discussion: https://postgr.es/m/CAGPqQf0KitkNack4F5CFkFi-9Dqvp29Ro=EpcWt=4_hs-rt...@mail.gmail.com Branch -- master Details -

pgsql: Use specific collation where needed in new test

2025-04-07 Thread Álvaro Herrera
Use specific collation where needed in new test Oversight in commit a379061a22a8. Per Czech buildfarm members jay and hippopotamus. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/17bcf4f5450430f67b744c225566c9e0e6413e95 Modified Files -- src/test/regr

pgsql: Elide not-null constraint checks on child tables during PK creat

2025-04-16 Thread Álvaro Herrera
Elide not-null constraint checks on child tables during PK creation We were unnecessarily acquiring AccessExclusiveLock on all child tables when "ALTER TABLE ONLY sometab ADD PRIMARY KEY" was run on their parent table, an oversight in commit 14e87ffa5c54. This caused deadlocks during pg_restore o

pgsql: Handle self-referencing FKs correctly in partitioned tables

2025-05-02 Thread Álvaro Herrera
Handle self-referencing FKs correctly in partitioned tables For self-referencing foreign keys in partitioned tables, we weren't handling creation of pg_constraint rows during CREATE TABLE PARTITION AS as well as ALTER TABLE ATTACH PARTITION. This is an old bug -- mostly, we broke this in 614a406b

pgsql: Handle self-referencing FKs correctly in partitioned tables

2025-05-02 Thread Álvaro Herrera
Handle self-referencing FKs correctly in partitioned tables For self-referencing foreign keys in partitioned tables, we weren't handling creation of pg_constraint rows during CREATE TABLE PARTITION AS as well as ALTER TABLE ATTACH PARTITION. This is an old bug -- mostly, we broke this in 614a406b

pgsql: Handle self-referencing FKs correctly in partitioned tables

2025-05-02 Thread Álvaro Herrera
Handle self-referencing FKs correctly in partitioned tables For self-referencing foreign keys in partitioned tables, we weren't handling creation of pg_constraint rows during CREATE TABLE PARTITION AS as well as ALTER TABLE ATTACH PARTITION. This is an old bug -- mostly, we broke this in 614a406b

pgsql: Handle self-referencing FKs correctly in partitioned tables

2025-05-02 Thread Álvaro Herrera
Handle self-referencing FKs correctly in partitioned tables For self-referencing foreign keys in partitioned tables, we weren't handling creation of pg_constraint rows during CREATE TABLE PARTITION AS as well as ALTER TABLE ATTACH PARTITION. This is an old bug -- mostly, we broke this in 614a406b

pgsql: Handle self-referencing FKs correctly in partitioned tables

2025-05-02 Thread Álvaro Herrera
Handle self-referencing FKs correctly in partitioned tables For self-referencing foreign keys in partitioned tables, we weren't handling creation of pg_constraint rows during CREATE TABLE PARTITION AS as well as ALTER TABLE ATTACH PARTITION. This is an old bug -- mostly, we broke this in 614a406b

pgsql: Handle self-referencing FKs correctly in partitioned tables

2025-05-02 Thread Álvaro Herrera
Handle self-referencing FKs correctly in partitioned tables For self-referencing foreign keys in partitioned tables, we weren't handling creation of pg_constraint rows during CREATE TABLE PARTITION AS as well as ALTER TABLE ATTACH PARTITION. This is an old bug -- mostly, we broke this in 614a406b

pgsql: Fix pg_dump for inherited validated not-null constraints

2025-04-28 Thread Álvaro Herrera
ld be incorrect. Co-authored-by: jian he Co-authored-by: Álvaro Herrera Reported-by: jian he Message-id: https://postgr.es/m/CACJufxGHNNMc0E2JphUqJMzD3=bwrsuaevbf5ekgkg8uy0q...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commi

pgsql: Translation updates

2025-02-17 Thread Álvaro Herrera
Translation updates Source-Git-URL: ssh://g...@git.postgresql.org/pgtranslation/messages.git Source-Git-Hash: 8fbdbed3216a3cdbb9ca74f3d9d990b4e96100e3 Branch -- REL_14_STABLE Details --- https://git.postgresql.org/pg/commitdiff/50fabe48e39858eacf8a56e0da1ba7610ae537ae Modified Files ---

  1   2   3   >