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

Commitbe73e70

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 parente498d22 commitbe73e70

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
@@ -378,8 +378,17 @@ expand_partitioned_rtentry(PlannerInfo *root, RelOptInfo *relinfo,
378378
IndexchildRTindex;
379379
RelOptInfo*childrelinfo;
380380

381-
/* Open rel, acquiring required locks */
382-
childrel=table_open(childOID,lockmode);
381+
/*
382+
* Open rel, acquiring required locks. If a partition was recently
383+
* detached and subsequently dropped, then opening it will fail. In
384+
* this case, behave as though the partition had been pruned.
385+
*/
386+
childrel=try_table_open(childOID,lockmode);
387+
if (childrel==NULL)
388+
{
389+
relinfo->live_parts=bms_del_member(relinfo->live_parts,i);
390+
continue;
391+
}
383392

384393
/*
385394
* Temporary partitions belonging to other sessions should have been

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp