]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Avoid failure to open dropped detached partition
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Mon, 19 Aug 2024 20:09:10 +0000 (16:09 -0400)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Mon, 19 Aug 2024 20:09:10 +0000 (16:09 -0400)
commitbe73e7008558cef1f59b0f4a61cefb6ec53c45c5
tree83723ffcf0ed0b9cf1dc18f5eba2704e2606a334
parente498d22e21358e196c1db9b5f1300eae667ea2bd
Avoid failure to open dropped detached partition

When a partition is detached and immediately dropped, a prepared
statement could try to compute a new partition descriptor that includes
it.  This leads to this kind of error:
ERROR:  could not open relation with OID 457639

Avoid this by skipping the partition in expand_partitioned_rtentry if it
doesn't exist.

Noted by me while investigating bug #18559.  Kuntal Gosh helped to
identify the exact failure.

Backpatch to 14, where DETACH CONCURRENTLY was introduced.

Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
Reviewed-by: Kuntal Ghosh <kuntalghosh.2007@gmail.com>
Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>
Discussion: https://postgr.es/m/202408122233.bo4adt3vh5bi@alvherre.pgsql
src/backend/optimizer/util/inherit.c