]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix creation of partition descriptor during concurrent detach
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Tue, 11 Jun 2024 09:38:45 +0000 (11:38 +0200)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Tue, 11 Jun 2024 09:38:45 +0000 (11:38 +0200)
commitbf78abebf3e5c827a48186b2b1388c691e16fafc
treeff5c4712736c088aeae6bb60b2dd2a3c731e83dd
parentc7972f12261717dfb1009096a45babcb2f9b5275
Fix creation of partition descriptor during concurrent detach

When a partition is being detached in concurrent mode, it is possible
for find_inheritance_children_extended() to return that partition in the
list, and immediately after that receive an invalidation message that
sets its relpartbound to NULL just before we read it.  (This can happen
because table_open() reads invalidation messages.)  Currently we raise
an error
  ERROR:  missing relpartbound for relation %u
about the situation, but that's bogus because the table is no longer a
partition, so we shouldn't be complaining about it.  A better reaction
is to retry the find_inheritance_children_extended call to get a new
list, which will no longer have the partition being detached.

Noticed while investigating bug #18377.

Backpatch to 14, where DETACH CONCURRENTLY appeared.

Discussion: https://postgr.es/m/202405201616.y4ht2qe5ihoy@alvherre.pgsql
src/backend/partitioning/partdesc.c