pgsql: Add test for temporal referential integrity

2025-09-17 Thread Álvaro Herrera
Add test for temporal referential integrity This commit adds an isolation test showing that temporal foreign keys do not permit referential integrity violations under concurrency, like fk-snapshot-2. You can show that the test fails by passing false for detectNewRows to ri_PerformCheck in ri_rest

pgsql: Avoid unexpected changes of CurrentResourceOwner and CurrentMemo

2025-09-12 Thread Álvaro Herrera
Avoid unexpected changes of CurrentResourceOwner and CurrentMemoryContext Users of logical decoding can encounter an unexpected change of CurrentResourceOwner and CurrentMemoryContext. The problem is that, unlike other call sites of RollbackAndReleaseCurrentSubTransaction(), in reorderbuffer.c we

pgsql: Improve comment about snapshot macros

2025-09-11 Thread Álvaro Herrera
Improve comment about snapshot macros The comment mistakenly had "the others" for "the other", but this commit also reorders the comment so it matches the macros below. Now we describe the levels in increasing strictness. In addition, it seems easier to follow if we introduce one level at a time

pgsql: Fill testing gap for possible referential integrity violation

2025-09-11 Thread Álvaro Herrera
Fill testing gap for possible referential integrity violation This commit adds a missing isolation test for (non-PERIOD) foreign keys. With REPEATABLE READ, one transaction can insert a referencing row while another deletes the referenced row, and both see a valid state. But after they have commi

pgsql: CREATE STATISTICS: improve misleading error message

2025-08-29 Thread Álvaro Herrera
CREATE STATISTICS: improve misleading error message I think the error message for a different condition was inadvertently copied. This problem seems to have been introduced by commit a4d75c86bf15. Author: Álvaro Herrera Reported-by: jian he Reviewed-by: Tom Lane Backpatch-through: 14

pgsql: CREATE STATISTICS: improve misleading error message

2025-08-29 Thread Álvaro Herrera
CREATE STATISTICS: improve misleading error message I think the error message for a different condition was inadvertently copied. This problem seems to have been introduced by commit a4d75c86bf15. Author: Álvaro Herrera Reported-by: jian he Reviewed-by: Tom Lane Backpatch-through: 14

pgsql: CREATE STATISTICS: improve misleading error message

2025-08-29 Thread Álvaro Herrera
CREATE STATISTICS: improve misleading error message I think the error message for a different condition was inadvertently copied. This problem seems to have been introduced by commit a4d75c86bf15. Author: Álvaro Herrera Reported-by: jian he Reviewed-by: Tom Lane Backpatch-through: 14

pgsql: CREATE STATISTICS: improve misleading error message

2025-08-29 Thread Álvaro Herrera
CREATE STATISTICS: improve misleading error message I think the error message for a different condition was inadvertently copied. This problem seems to have been introduced by commit a4d75c86bf15. Author: Álvaro Herrera Reported-by: jian he Reviewed-by: Tom Lane Backpatch-through: 14

pgsql: CREATE STATISTICS: improve misleading error message

2025-08-29 Thread Álvaro Herrera
CREATE STATISTICS: improve misleading error message I think the error message for a different condition was inadvertently copied. This problem seems to have been introduced by commit a4d75c86bf15. Author: Álvaro Herrera Reported-by: jian he Reviewed-by: Tom Lane Backpatch-through: 14

pgsql: CREATE STATISTICS: improve misleading error message

2025-08-29 Thread Álvaro Herrera
CREATE STATISTICS: improve misleading error message I think the error message for a different condition was inadvertently copied. This problem seems to have been introduced by commit a4d75c86bf15. Author: Álvaro Herrera Reported-by: jian he Reviewed-by: Tom Lane Backpatch-through: 14

pgsql: Glossary: improve definition of "relation"

2025-08-28 Thread Álvaro Herrera
Glossary: improve definition of "relation" Define the more general term first, then the Postgres-specific meaning. Wording from Tom Lane. Discussion: https://postgr.es/m/CACJufxEZ48toGH0Em_6vdsT57Y3L8pLF=DZCQ_gCii6=c3m...@mail.gmail.com Branch -- master Details --- https://git.postgre

pgsql: Avoid including commands/dbcommands.h in so many places

2025-08-28 Thread Álvaro Herrera
ar in pg_database.h rather than dbcommands.h). Clean this up. Also, xlogreader.h and stringinfo.h are no longer needed by dbcommands.h since commit f1fd515b393a, so remove them. Author: Álvaro Herrera Reviewed-by: Bertrand Drouvot Reviewed-by: Michael Paquier Discussion: https://postgr

Re: pgsql: Move SQL-callable code related to multixacts into its own file

2025-08-19 Thread Álvaro Herrera
AFAIR the current arrangement is purposefully what is is. I did discover that my build script does "make install ; make -C contrib install", which means src/test/modules is not built. But that's a local fix for me. -- Álvaro HerreraBreisgau, Deutschland — https://www.Ente

Re: pgsql: Move SQL-callable code related to multixacts into its own file

2025-08-19 Thread Álvaro Herrera
n stop including dbcommands.h. This seems a nice cleanup to me, and passes headerscheck. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ >From 125ad88f2fd930508a883acbd06b330378756c87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Herrera?= Date: Tu

pgsql: Avoid including tableam.h and xlogreader.h in nbtree.h

2025-08-14 Thread Álvaro Herrera
_bt_delitems_delete_check()'s declaration can use it. Author: Álvaro Herrera Reviewed-by: Bertrand Drouvot Discussion: https://postgr.es/m/202508051109.lzk3lcuzsaxo@alvherre.pgsql Branch -- master Details --- https://git.postgresql.org/pg/commi

pgsql: Put PG_TEST_EXTRA doc items back in alphabetical order

2025-08-05 Thread Álvaro Herrera
Put PG_TEST_EXTRA doc items back in alphabetical order A few items appears to have added in random order over the years. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/455a040d966897edd3901f044945398450da338a Modified Files -- doc/src/sgml/regress.sgml

pgsql: Put PG_TEST_EXTRA doc items back in alphabetical order

2025-08-05 Thread Álvaro Herrera
Put PG_TEST_EXTRA doc items back in alphabetical order A few items appears to have added in random order over the years. Branch -- REL_18_STABLE Details --- https://git.postgresql.org/pg/commitdiff/f71ad5b082f3c714af6f3c43b0df1fe8e68f91e6 Modified Files -- doc/src/sgml/regre

pgsql: Hide expensive pg_upgrade test behind PG_TEST_EXTRA

2025-08-05 Thread Álvaro Herrera
Hide expensive pg_upgrade test behind PG_TEST_EXTRA This new test is very expensive. Make it opt-in. Discussion: https://postgr.es/m/202508051433.ebznuqrxt4b2@alvherre.pgsql Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/37fc1803cc12120f19184cd952865cc35e0f1755

pgsql: Hide expensive pg_upgrade test behind PG_TEST_EXTRA

2025-08-05 Thread Álvaro Herrera
Hide expensive pg_upgrade test behind PG_TEST_EXTRA This new test is very expensive. Make it opt-in. Discussion: https://postgr.es/m/202508051433.ebznuqrxt4b2@alvherre.pgsql Branch -- REL_18_STABLE Details --- https://git.postgresql.org/pg/commitdiff/d185161e4739282de72083374e32451b10c

pgsql: Rename XLogData protocol message to WALData

2025-08-04 Thread Álvaro Herrera
Rename XLogData protocol message to WALData This name is only used as documentation, and using this name is consistent with its byte being a 'w'. Renaming it would also make the use of a symbolic name based on the word "WAL" rather than the obsolete "XLog" term more consistent, per future commits

pgsql: doc: mention unusability of dropped CHECK to verify NOT NULL

2025-08-04 Thread Álvaro Herrera
doc: mention unusability of dropped CHECK to verify NOT NULL It's possible to use a CHECK (col IS NOT NULL) constraint to skip scanning a table for nulls when adding a NOT NULL constraint on the same column. However, if the CHECK constraint is dropped on the same command that the NOT NULL is adde

pgsql: doc: mention unusability of dropped CHECK to verify NOT NULL

2025-08-04 Thread Álvaro Herrera
doc: mention unusability of dropped CHECK to verify NOT NULL It's possible to use a CHECK (col IS NOT NULL) constraint to skip scanning a table for nulls when adding a NOT NULL constraint on the same column. However, if the CHECK constraint is dropped on the same command that the NOT NULL is adde

pgsql: doc: mention unusability of dropped CHECK to verify NOT NULL

2025-08-04 Thread Álvaro Herrera
doc: mention unusability of dropped CHECK to verify NOT NULL It's possible to use a CHECK (col IS NOT NULL) constraint to skip scanning a table for nulls when adding a NOT NULL constraint on the same column. However, if the CHECK constraint is dropped on the same command that the NOT NULL is adde

pgsql: doc: mention unusability of dropped CHECK to verify NOT NULL

2025-08-04 Thread Álvaro Herrera
doc: mention unusability of dropped CHECK to verify NOT NULL It's possible to use a CHECK (col IS NOT NULL) constraint to skip scanning a table for nulls when adding a NOT NULL constraint on the same column. However, if the CHECK constraint is dropped on the same command that the NOT NULL is adde

pgsql: doc: mention unusability of dropped CHECK to verify NOT NULL

2025-08-04 Thread Álvaro Herrera
doc: mention unusability of dropped CHECK to verify NOT NULL It's possible to use a CHECK (col IS NOT NULL) constraint to skip scanning a table for nulls when adding a NOT NULL constraint on the same column. However, if the CHECK constraint is dropped on the same command that the NOT NULL is adde

pgsql: doc: mention unusability of dropped CHECK to verify NOT NULL

2025-08-04 Thread Álvaro Herrera
doc: mention unusability of dropped CHECK to verify NOT NULL It's possible to use a CHECK (col IS NOT NULL) constraint to skip scanning a table for nulls when adding a NOT NULL constraint on the same column. However, if the CHECK constraint is dropped on the same command that the NOT NULL is adde

pgsql: doc: mention unusability of dropped CHECK to verify NOT NULL

2025-08-04 Thread Álvaro Herrera
doc: mention unusability of dropped CHECK to verify NOT NULL It's possible to use a CHECK (col IS NOT NULL) constraint to skip scanning a table for nulls when adding a NOT NULL constraint on the same column. However, if the CHECK constraint is dropped on the same command that the NOT NULL is adde

pgsql: Refactor grammar to create opt_utility_option_list

2025-07-25 Thread Álvaro Herrera
Refactor grammar to create opt_utility_option_list This changes the grammar for REINDEX, CHECKPOINT, CLUSTER, ANALYZE/ANALYSE; they still accept the same options as before, but the grammar is written differently for convenience of future development. Reviewed-by: Nathan Bossart Discussion: https

pgsql: Move enum RecoveryTargetAction to xlogrecovery.h

2025-07-23 Thread Álvaro Herrera
Move enum RecoveryTargetAction to xlogrecovery.h Commit 70e81861fadd split out xlogrecovery.c/h and moved some enums related to recovery targets to xlogrecovery.h. However, it seems that the enum RecoveryTargetAction was inadvertently left out by that commit. This commit moves it to xlogrecovery.h

Re: pgsql: Log remote NOTICE, WARNING, and similar messages using ereport()

2025-07-22 Thread Álvaro Herrera
e's actually a bunch of additional work to do if we want to do that. IMO the proper fix for this, at least for now, is to remove it: https://www.postgresql.org/message-id/202507221147.sdg2rmhbqb5z%40alvherre.pgsql -- Álvaro HerreraBreisgau, Deutschland — https://www.EnterpriseDB.com/

pgsql: pg_dump: include comments on not-null constraints on domains, to

2025-07-21 Thread Álvaro Herrera
for them, this one also forgot. Add that now. We also need to teach repairDependencyLoop() about the new type of constraints being possible for domains. Backpatch-through: 17 Co-authored-by: jian he Co-authored-by: Álvaro Herrera Reported-by: jian he Discussion: https://postgr.es/m/CACJufxF

pgsql: pg_dump: include comments on not-null constraints on domains, to

2025-07-21 Thread Álvaro Herrera
for them, this one also forgot. Add that now. We also need to teach repairDependencyLoop() about the new type of constraints being possible for domains. Backpatch-through: 17 Co-authored-by: jian he Co-authored-by: Álvaro Herrera Reported-by: jian he Discussion: https://postgr.es/m/CACJufxF

pgsql: pg_dump: include comments on not-null constraints on domains, to

2025-07-21 Thread Álvaro Herrera
for them, this one also forgot. Add that now. We also need to teach repairDependencyLoop() about the new type of constraints being possible for domains. Backpatch-through: 17 Co-authored-by: jian he Co-authored-by: Álvaro Herrera Reported-by: jian he Discussion: https://postgr.es/m/CACJufxF

Re: pgsql: Remove assertion from PortalRunMulti

2025-07-17 Thread Álvaro Herrera
Hello, On 2025-Jul-17, Aleksander Alekseev wrote: > > Reported-by: Aleksander Alekseev > > I didn't report this issue, it was done by Alexander Lakhin. Uh, you're right, my mistake -- apologies. -- Álvaro Herrera 48°01'N 7°57'E — https://www.E

pgsql: Remove assertion from PortalRunMulti

2025-07-17 Thread Álvaro Herrera
Remove assertion from PortalRunMulti We have an assertion to ensure that a command tag has been assigned by the time we're done executing, but if we happen to execute a command with no queries, the assertion would fail. Per discussion, rather than contort things to get a tag assigned, just remove

pgsql: Remove assertion from PortalRunMulti

2025-07-17 Thread Álvaro Herrera
Remove assertion from PortalRunMulti We have an assertion to ensure that a command tag has been assigned by the time we're done executing, but if we happen to execute a command with no queries, the assertion would fail. Per discussion, rather than contort things to get a tag assigned, just remove

pgsql: Remove assertion from PortalRunMulti

2025-07-17 Thread Álvaro Herrera
Remove assertion from PortalRunMulti We have an assertion to ensure that a command tag has been assigned by the time we're done executing, but if we happen to execute a command with no queries, the assertion would fail. Per discussion, rather than contort things to get a tag assigned, just remove

pgsql: Remove assertion from PortalRunMulti

2025-07-17 Thread Álvaro Herrera
Remove assertion from PortalRunMulti We have an assertion to ensure that a command tag has been assigned by the time we're done executing, but if we happen to execute a command with no queries, the assertion would fail. Per discussion, rather than contort things to get a tag assigned, just remove

pgsql: Remove assertion from PortalRunMulti

2025-07-17 Thread Álvaro Herrera
Remove assertion from PortalRunMulti We have an assertion to ensure that a command tag has been assigned by the time we're done executing, but if we happen to execute a command with no queries, the assertion would fail. Per discussion, rather than contort things to get a tag assigned, just remove

pgsql: Remove assertion from PortalRunMulti

2025-07-17 Thread Álvaro Herrera
Remove assertion from PortalRunMulti We have an assertion to ensure that a command tag has been assigned by the time we're done executing, but if we happen to execute a command with no queries, the assertion would fail. Per discussion, rather than contort things to get a tag assigned, just remove

pgsql: Remove assertion from PortalRunMulti

2025-07-17 Thread Álvaro Herrera
Remove assertion from PortalRunMulti We have an assertion to ensure that a command tag has been assigned by the time we're done executing, but if we happen to execute a command with no queries, the assertion would fail. Per discussion, rather than contort things to get a tag assigned, just remove

pgsql: Fix dumping of comments on invalid constraints on domains

2025-07-16 Thread Álvaro Herrera
Fix dumping of comments on invalid constraints on domains We skip dumping constraints together with domains if they are invalid ('separate') so that they appear after data -- but their comments were dumped together with the domain definition, which in effect leads to the comment being dumped when

pgsql: Fix dumping of comments on invalid constraints on domains

2025-07-16 Thread Álvaro Herrera
Fix dumping of comments on invalid constraints on domains We skip dumping constraints together with domains if they are invalid ('separate') so that they appear after data -- but their comments were dumped together with the domain definition, which in effect leads to the comment being dumped when

pgsql: Fix dumping of comments on invalid constraints on domains

2025-07-16 Thread Álvaro Herrera
Fix dumping of comments on invalid constraints on domains We skip dumping constraints together with domains if they are invalid ('separate') so that they appear after data -- but their comments were dumped together with the domain definition, which in effect leads to the comment being dumped when

pgsql: Fix dumping of comments on invalid constraints on domains

2025-07-16 Thread Álvaro Herrera
Fix dumping of comments on invalid constraints on domains We skip dumping constraints together with domains if they are invalid ('separate') so that they appear after data -- but their comments were dumped together with the domain definition, which in effect leads to the comment being dumped when

pgsql: Fix dumping of comments on invalid constraints on domains

2025-07-16 Thread Álvaro Herrera
Fix dumping of comments on invalid constraints on domains We skip dumping constraints together with domains if they are invalid ('separate') so that they appear after data -- but their comments were dumped together with the domain definition, which in effect leads to the comment being dumped when

pgsql: Fix dumping of comments on invalid constraints on domains

2025-07-16 Thread Álvaro Herrera
Fix dumping of comments on invalid constraints on domains We skip dumping constraints together with domains if they are invalid ('separate') so that they appear after data -- but their comments were dumped together with the domain definition, which in effect leads to the comment being dumped when

pgsql: Fix dumping of comments on invalid constraints on domains

2025-07-16 Thread Álvaro Herrera
Fix dumping of comments on invalid constraints on domains We skip dumping constraints together with domains if they are invalid ('separate') so that they appear after data -- but their comments were dumped together with the domain definition, which in effect leads to the comment being dumped when

pgsql: Fix a couple more places in docs for pg_lsn change

2025-07-08 Thread Álvaro Herrera
Fix a couple more places in docs for pg_lsn change Also, revert Unicode linestyle to ASCII. Reported-by: Japin Li Discussion: https://postgr.es/m/me0p300mb04453a39931f95805c4205a8b6...@me0p300mb0445.ausp300.prod.outlook.com Branch -- master Details --- https://git.postgresql.org/pg/co

pgsql: Adapt pg_upgrade test to pg_lsn output format difference

2025-07-07 Thread Álvaro Herrera
Adapt pg_upgrade test to pg_lsn output format difference Commit 2633dae2e487 added some zero padding to various LSNs output routines so that the low word is always 8 hex digits long, for easy human consumption. This included the pg_lsn datatype, which breaks the pg_upgrade test when it compares t

pgsql: Refactor some repetitive SLRU code

2025-07-07 Thread Álvaro Herrera
page to disk - XLogSimpleInsertInt64: Does a XLogBeginInsert followed by XLogInsert of a trivial record whose data is just an int64. Author: Evgeny Voropaev Reviewed by: Álvaro Herrera Reviewed by: Andrey Borodin Reviewed by: Aleksander Alekseev Discussion: https://www.postgresql.org/message

pgsql: Standardize LSN formatting by zero padding

2025-07-07 Thread Álvaro Herrera
confusion when comparing. To address this, the LSN format is now uniformly set to `%X/%08X`, ensuring the lower 32-bit part is always zero-padded to eight hexadecimal digits. Author: Japin Li Reviewed-by: Masahiko Sawada Reviewed-by: Álvaro Herrera Discussion: https://postgr.es/m

pgsql: Fix new pg_upgrade query not to rely on regnamespace

2025-07-04 Thread Álvaro Herrera
Fix new pg_upgrade query not to rely on regnamespace That was invented in 9.5, and pg_upgrade claims to support back to 9.0. But we don't need that with a simple query change, tested by Tom Lane. Discussion: https://postgr.es/m/202507041645.afjl5rssvrgu@alvherre.pgsql Branch -- REL_17_STABLE

pgsql: Fix new pg_upgrade query not to rely on regnamespace

2025-07-04 Thread Álvaro Herrera
Fix new pg_upgrade query not to rely on regnamespace That was invented in 9.5, and pg_upgrade claims to support back to 9.0. But we don't need that with a simple query change, tested by Tom Lane. Discussion: https://postgr.es/m/202507041645.afjl5rssvrgu@alvherre.pgsql Branch -- REL_15_STABLE

pgsql: pg_upgrade: Add missing newline in error message

2025-07-04 Thread Álvaro Herrera
pg_upgrade: Add missing newline in error message Minor oversight in 347758b12063 Branch -- REL_18_STABLE Details --- https://git.postgresql.org/pg/commitdiff/5aba3e637d3d874f7bf00318c828249a964c4c3c Modified Files -- src/bin/pg_upgrade/check.c | 2 +- 1 file changed, 1 insert

pgsql: Fix new pg_upgrade query not to rely on regnamespace

2025-07-04 Thread Álvaro Herrera
Fix new pg_upgrade query not to rely on regnamespace That was invented in 9.5, and pg_upgrade claims to support back to 9.0. But we don't need that with a simple query change, tested by Tom Lane. Discussion: https://postgr.es/m/202507041645.afjl5rssvrgu@alvherre.pgsql Branch -- master Detai

pgsql: Fix new pg_upgrade query not to rely on regnamespace

2025-07-04 Thread Álvaro Herrera
Fix new pg_upgrade query not to rely on regnamespace That was invented in 9.5, and pg_upgrade claims to support back to 9.0. But we don't need that with a simple query change, tested by Tom Lane. Discussion: https://postgr.es/m/202507041645.afjl5rssvrgu@alvherre.pgsql Branch -- REL_13_STABLE

pgsql: Fix new pg_upgrade query not to rely on regnamespace

2025-07-04 Thread Álvaro Herrera
Fix new pg_upgrade query not to rely on regnamespace That was invented in 9.5, and pg_upgrade claims to support back to 9.0. But we don't need that with a simple query change, tested by Tom Lane. Discussion: https://postgr.es/m/202507041645.afjl5rssvrgu@alvherre.pgsql Branch -- REL_14_STABLE

pgsql: pg_upgrade: Add missing newline in error message

2025-07-04 Thread Álvaro Herrera
pg_upgrade: Add missing newline in error message Minor oversight in 347758b12063 Branch -- REL_17_STABLE Details --- https://git.postgresql.org/pg/commitdiff/0807a4656edcfdc2f900bc070a4a8592a0a7f880 Modified Files -- src/bin/pg_upgrade/check.c | 2 +- 1 file changed, 1 insert

pgsql: pg_upgrade: Add missing newline in error message

2025-07-04 Thread Álvaro Herrera
pg_upgrade: Add missing newline in error message Minor oversight in 347758b12063 Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/90a85fce5e9b9ea63ec7e1b3001e0f39d4c8b7d4 Modified Files -- src/bin/pg_upgrade/check.c | 2 +- 1 file changed, 1 insertion(+),

pgsql: Fix new pg_upgrade query not to rely on regnamespace

2025-07-04 Thread Álvaro Herrera
Fix new pg_upgrade query not to rely on regnamespace That was invented in 9.5, and pg_upgrade claims to support back to 9.0. But we don't need that with a simple query change, tested by Tom Lane. Discussion: https://postgr.es/m/202507041645.afjl5rssvrgu@alvherre.pgsql Branch -- REL_16_STABLE

pgsql: Fix new pg_upgrade query not to rely on regnamespace

2025-07-04 Thread Álvaro Herrera
Fix new pg_upgrade query not to rely on regnamespace That was invented in 9.5, and pg_upgrade claims to support back to 9.0. But we don't need that with a simple query change, tested by Tom Lane. Discussion: https://postgr.es/m/202507041645.afjl5rssvrgu@alvherre.pgsql Branch -- REL_18_STABLE

pgsql: pg_upgrade: check for inconsistencies in not-null constraints w/

2025-07-04 Thread Álvaro Herrera
pg_upgrade: check for inconsistencies in not-null constraints w/inheritance With tables defined like this, CREATE TABLE ip (id int PRIMARY KEY); CREATE TABLE ic (id int) INHERITS (ip); ALTER TABLE ic ALTER id DROP NOT NULL; pg_upgrade fails during the schema restore phase due to this error:

pgsql: pg_upgrade: check for inconsistencies in not-null constraints w/

2025-07-04 Thread Álvaro Herrera
pg_upgrade: check for inconsistencies in not-null constraints w/inheritance With tables defined like this, CREATE TABLE ip (id int PRIMARY KEY); CREATE TABLE ic (id int) INHERITS (ip); ALTER TABLE ic ALTER id DROP NOT NULL; pg_upgrade fails during the schema restore phase due to this error:

pgsql: pg_upgrade: check for inconsistencies in not-null constraints w/

2025-07-04 Thread Álvaro Herrera
pg_upgrade: check for inconsistencies in not-null constraints w/inheritance With tables defined like this, CREATE TABLE ip (id int PRIMARY KEY); CREATE TABLE ic (id int) INHERITS (ip); ALTER TABLE ic ALTER id DROP NOT NULL; pg_upgrade fails during the schema restore phase due to this error:

pgsql: pg_upgrade: check for inconsistencies in not-null constraints w/

2025-07-04 Thread Álvaro Herrera
pg_upgrade: check for inconsistencies in not-null constraints w/inheritance With tables defined like this, CREATE TABLE ip (id int PRIMARY KEY); CREATE TABLE ic (id int) INHERITS (ip); ALTER TABLE ic ALTER id DROP NOT NULL; pg_upgrade fails during the schema restore phase due to this error:

pgsql: pg_upgrade: check for inconsistencies in not-null constraints w/

2025-07-04 Thread Álvaro Herrera
pg_upgrade: check for inconsistencies in not-null constraints w/inheritance With tables defined like this, CREATE TABLE ip (id int PRIMARY KEY); CREATE TABLE ic (id int) INHERITS (ip); ALTER TABLE ic ALTER id DROP NOT NULL; pg_upgrade fails during the schema restore phase due to this error:

pgsql: pg_upgrade: check for inconsistencies in not-null constraints w/

2025-07-04 Thread Álvaro Herrera
pg_upgrade: check for inconsistencies in not-null constraints w/inheritance With tables defined like this, CREATE TABLE ip (id int PRIMARY KEY); CREATE TABLE ic (id int) INHERITS (ip); ALTER TABLE ic ALTER id DROP NOT NULL; pg_upgrade fails during the schema restore phase due to this error:

pgsql: pg_upgrade: check for inconsistencies in not-null constraints w/

2025-07-04 Thread Álvaro Herrera
pg_upgrade: check for inconsistencies in not-null constraints w/inheritance With tables defined like this, CREATE TABLE ip (id int PRIMARY KEY); CREATE TABLE ic (id int) INHERITS (ip); ALTER TABLE ic ALTER id DROP NOT NULL; pg_upgrade fails during the schema restore phase due to this error:

pgsql: Add tab-completion for ALTER TABLE not-nulls

2025-07-03 Thread Álvaro Herrera
r now. Author: Álvaro Herrera Reported-by: Fujii Masao Reviewed-by: Fujii Masao Reviewed-by: Dagfinn Ilmari Mannsåker Discussion: https://postgr.es/m/d4f14c6b-086b-463c-b15f-01c7c9728...@oss.nttdata.com Discussion: https://postgr.es/m/202505111448.bwbfomrymq4b@alvherre.pgsql Branch -- m

Re: pgsql: Fix bogus grammar for a CREATE CONSTRAINT TRIGGER error

2025-07-03 Thread Álvaro Herrera
On 2025-Jul-03, Daniel Gustafsson wrote: > > On 3 Jul 2025, at 11:30, Álvaro Herrera wrote: > > alabio seems unhappy, and the hunk below seems to be culprit, it should closed > with a right? Thanks for pointing this out. Yeah, not only I used the wrong tag, but it's also

pgsql: Fix broken XML

2025-07-03 Thread Álvaro Herrera
Fix broken XML I messed this up in commit 87251e114967. Per buildfarm member alabio, via Daniel Gustafsson. Discussion: https://postgr.es/m/b94d82d1-7af4-4412-ac02-82eaa6154...@yesql.se Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/81a2625eb2e4608ba6ca41b2bf548d

pgsql: Prevent creation of duplicate not-null constraints for domains

2025-07-03 Thread Álvaro Herrera
Prevent creation of duplicate not-null constraints for domains This was previously harmless, but now that we create pg_constraint rows for those, duplicates are not welcome anymore. Backpatch to 18. Co-authored-by: jian he Co-authored-by: Álvaro Herrera Discussion: https://postgr.es/m

pgsql: Prevent creation of duplicate not-null constraints for domains

2025-07-03 Thread Álvaro Herrera
Prevent creation of duplicate not-null constraints for domains This was previously harmless, but now that we create pg_constraint rows for those, duplicates are not welcome anymore. Backpatch to 18. Co-authored-by: jian he Co-authored-by: Álvaro Herrera Discussion: https://postgr.es/m

pgsql: Fix bogus grammar for a CREATE CONSTRAINT TRIGGER error

2025-07-03 Thread Álvaro Herrera
he Reviewed-by: Fujii Masao Reviewed-by: Álvaro Herrera Discussion: https://postgr.es/m/caaj_b97hd-jmts7ajgu6tdbczdx_kyukxg+k-dtymoieg+g...@mail.gmail.com Discussion: https://postgr.es/m/CACJufxHSp2puxP=q8ztugl1f+heapnzqfbzy5zngujugwjb...@mail.gmail.com Branch -- master Detail

pgsql: Fix error message for ALTER CONSTRAINT ... NOT VALID

2025-07-02 Thread Álvaro Herrera
error message as well. Co-authored-by: jian he Co-authored-by: Fujii Masao Co-authored-by: Álvaro Herrera Co-authored-by: Amul Sul Discussion: https://postgr.es/m/CACJufxHSp2puxP=q8ztugl1f+heapnzqfbzy5zngujugwjb...@mail.gmail.com Branch -- REL_18_STABLE Details --- https

pgsql: Fix error message for ALTER CONSTRAINT ... NOT VALID

2025-07-02 Thread Álvaro Herrera
error message as well. Co-authored-by: jian he Co-authored-by: Fujii Masao Co-authored-by: Álvaro Herrera Co-authored-by: Amul Sul Discussion: https://postgr.es/m/CACJufxHSp2puxP=q8ztugl1f+heapnzqfbzy5zngujugwjb...@mail.gmail.com Branch -- master Details --- https

pgsql: Fix typo in comment

2025-06-26 Thread Álvaro Herrera
Fix typo in comment Introduced by c2da1a5d6325 Reported-by: Michael Paquier Discussion: https://postgr.es/m/aft4qerwrv-3q...@paquier.xyz Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/a3994ec6acb27545300ce1e336e4d119d8000ba9 Modified Files -- contrib

pgsql: pg_dump: include comments on valid not-null constraints, too

2025-06-26 Thread Álvaro Herrera
s for the comments. Co-Authored-By: Jian He Co-Authored-By: Álvaro Herrera Reported-By: Fujii Masao Reviewed-By: Fujii Masao Discussion: https://postgr.es/m/d50ff977-c728-4e9e-8488-fc2688e08...@oss.nttdata.com Branch -- master Details --- https://git.postgresql.org/pg/commi

pgsql: docs: fix typo

2025-06-26 Thread Álvaro Herrera
docs: fix typo Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/48c80aba7538d7c515d0c89f4d11f88974fee851 Modified Files -- doc/src/sgml/ref/pg_dump.sgml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

pgsql: Improve jumble squashing through CoerceViaIO and RelabelType

2025-06-24 Thread Álvaro Herrera
Improve jumble squashing through CoerceViaIO and RelabelType There's no principled reason for query jumbling to only remove the first layer of RelabelType and CoerceViaIO. Change it to see through as many layers as there are. Branch -- master Details --- https://git.postgresql.org/pg/co

pgsql: Make query jumbling also squash PARAM_EXTERN params

2025-06-24 Thread Álvaro Herrera
Make query jumbling also squash PARAM_EXTERN params Commit 62d712ecfd94 made query jumbling squash lists of Consts as a single element, but there's no reason not to treat PARAM_EXTERN parameters the same. For these purposes, these values are indeed constants for any particular execution of a quer

pgsql: Fix squashing algorithm for query texts

2025-06-12 Thread Álvaro Herrera
Fix squashing algorithm for query texts The algorithm to squash lists of constants added by commit 62d712ecfd94 was a bit too simplistic; we wanted to avoid adding unnecessary complexity, but cases like direct function calls of typecasting functions (and others) were missed, and bogus SQL syntax w

pgsql: Avoid bogus scans of partitions when marking FKs enforced

2025-06-05 Thread Álvaro Herrera
Avoid bogus scans of partitions when marking FKs enforced Similar to commit cc733ed164c5: when an unenforced foreign key that references a partitioned table is altered to be enforced, we scan the constrained table based on each partition on the referenced partitioned table. This is bogus and like

pgsql: Avoid bogus scans of partitions when validating FKs to partition

2025-06-05 Thread Álvaro Herrera
Avoid bogus scans of partitions when validating FKs to partitioned tables Validating an unvalidated foreign key that references a partitioned table would try to queue validations for each individual partition of the referenced table, but this is wrong: each individual partition would not necessari

pgsql: Fix broken-FK-detection query in release notes

2025-05-30 Thread Álvaro Herrera
Fix broken-FK-detection query in release notes Commits 53af9491a043 and 2d5fe514052a fixed a number of problems with foreign keys that reference partitioned tables, and a query to detect already broken FKs was supplied with the release notes for 17.1, 16.5, 15.9, 14.14, 13.17. However, that query

pgsql: Fix broken-FK-detection query in release notes

2025-05-30 Thread Álvaro Herrera
Fix broken-FK-detection query in release notes Commits 53af9491a043 and 2d5fe514052a fixed a number of problems with foreign keys that reference partitioned tables, and a query to detect already broken FKs was supplied with the release notes for 17.1, 16.5, 15.9, 14.14, 13.17. However, that query

pgsql: Fix broken-FK-detection query in release notes

2025-05-30 Thread Álvaro Herrera
Fix broken-FK-detection query in release notes Commits 53af9491a043 and 2d5fe514052a fixed a number of problems with foreign keys that reference partitioned tables, and a query to detect already broken FKs was supplied with the release notes for 17.1, 16.5, 15.9, 14.14, 13.17. However, that query

pgsql: Fix broken-FK-detection query in release notes

2025-05-30 Thread Álvaro Herrera
Fix broken-FK-detection query in release notes Commits 53af9491a043 and 2d5fe514052a fixed a number of problems with foreign keys that reference partitioned tables, and a query to detect already broken FKs was supplied with the release notes for 17.1, 16.5, 15.9, 14.14, 13.17. However, that query

pgsql: Fix broken-FK-detection query in release notes

2025-05-30 Thread Álvaro Herrera
Fix broken-FK-detection query in release notes Commits 53af9491a043 and 2d5fe514052a fixed a number of problems with foreign keys that reference partitioned tables, and a query to detect already broken FKs was supplied with the release notes for 17.1, 16.5, 15.9, 14.14, 13.17. However, that query

pgsql: Add tab-complete for ALTER DOMAIN ADD [CONSTRAINT]

2025-05-11 Thread Álvaro Herrera
Add tab-complete for ALTER DOMAIN ADD [CONSTRAINT] We can add tab-completion with "CHECK (" and "NOT NULL" after ALTER DOMAIN ADD [CONSTRAINT]. ALTER DOMAIN dom ADD -> CHECK ( ALTER DOMAIN dom ADD -> NOT NULL ALTER DOMAIN dom ADD -> CONSTRAINT ALTER DOMAIN dom ADD CONSTRAINT nm -> CHECK ( ALTER

pgsql: Fix comment of tsquerysend()

2025-05-11 Thread Álvaro Herrera
Fix comment of tsquerysend() The comment describes the order in which fields are sent, and it had one of the fields in the wrong place. This has been wrong since e6dbcb72fafa (2008), so backpatch all the way back. Author: Emre Hasegeli Discussion: https://postgr.es/m/CAE2gYzzf38bR_R=izhpmxamqh

pgsql: Fix comment of tsquerysend()

2025-05-11 Thread Álvaro Herrera
Fix comment of tsquerysend() The comment describes the order in which fields are sent, and it had one of the fields in the wrong place. This has been wrong since e6dbcb72fafa (2008), so backpatch all the way back. Author: Emre Hasegeli Discussion: https://postgr.es/m/CAE2gYzzf38bR_R=izhpmxamqh

pgsql: Fix comment of tsquerysend()

2025-05-11 Thread Álvaro Herrera
Fix comment of tsquerysend() The comment describes the order in which fields are sent, and it had one of the fields in the wrong place. This has been wrong since e6dbcb72fafa (2008), so backpatch all the way back. Author: Emre Hasegeli Discussion: https://postgr.es/m/CAE2gYzzf38bR_R=izhpmxamqh

pgsql: Fix comment of tsquerysend()

2025-05-11 Thread Álvaro Herrera
Fix comment of tsquerysend() The comment describes the order in which fields are sent, and it had one of the fields in the wrong place. This has been wrong since e6dbcb72fafa (2008), so backpatch all the way back. Author: Emre Hasegeli Discussion: https://postgr.es/m/CAE2gYzzf38bR_R=izhpmxamqh

pgsql: Fix comment of tsquerysend()

2025-05-11 Thread Álvaro Herrera
Fix comment of tsquerysend() The comment describes the order in which fields are sent, and it had one of the fields in the wrong place. This has been wrong since e6dbcb72fafa (2008), so backpatch all the way back. Author: Emre Hasegeli Discussion: https://postgr.es/m/CAE2gYzzf38bR_R=izhpmxamqh

pgsql: Fix comment of tsquerysend()

2025-05-11 Thread Álvaro Herrera
Fix comment of tsquerysend() The comment describes the order in which fields are sent, and it had one of the fields in the wrong place. This has been wrong since e6dbcb72fafa (2008), so backpatch all the way back. Author: Emre Hasegeli Discussion: https://postgr.es/m/CAE2gYzzf38bR_R=izhpmxamqh

pgsql: relcache: Avoid memory leak on tables with no CHECK constraints

2025-05-11 Thread Álvaro Herrera
relcache: Avoid memory leak on tables with no CHECK constraints As complained about by Valgrind, in commit a379061a22a8 I failed to realize that I was causing rd_att->constr->check to become allocated when no CHECK constraints exist; previously it'd remain NULL. (This was my bug, not the mentione

pgsql: Sort includes in alphabetical order

2025-05-11 Thread Álvaro Herrera
Sort includes in alphabetical order Added by commit 042a66291b04, no backpatch needed. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/7b2ad4342603c9796bf28dbe84aca247b2bfa9f8 Modified Files -- src/backend/utils/adt/mcxtfuncs.c | 4 ++-- 1 file changed,

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

  1   2   3   >