Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit52f3de8

Browse files
committed
Avoid failure to open dropped detached partition
When a partition is detached and immediately dropped, a preparedstatement could try to compute a new partition descriptor that includesit. This leads to this kind of error:ERROR: could not open relation with OID 457639Avoid this by skipping the partition in expand_partitioned_rtentry if itdoesn't exist.Noted by me while investigating bug #18559. Kuntal Gosh helped toidentify 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
1 parent0d06a7e commit52f3de8

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

‎src/backend/optimizer/util/inherit.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,17 @@ expand_partitioned_rtentry(PlannerInfo *root, RelOptInfo *relinfo,
386386
IndexchildRTindex;
387387
RelOptInfo*childrelinfo;
388388

389-
/* Open rel, acquiring required locks */
390-
childrel=table_open(childOID,lockmode);
389+
/*
390+
* Open rel, acquiring required locks. If a partition was recently
391+
* detached and subsequently dropped, then opening it will fail. In
392+
* this case, behave as though the partition had been pruned.
393+
*/
394+
childrel=try_table_open(childOID,lockmode);
395+
if (childrel==NULL)
396+
{
397+
relinfo->live_parts=bms_del_member(relinfo->live_parts,i);
398+
continue;
399+
}
391400

392401
/*
393402
* Temporary partitions belonging to other sessions should have been

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp