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

Commit9286ef8

Browse files
committed
Clean up sloppy coding in publicationcmds.c's OpenTableList().
Remove dead code (which would be incorrect if it weren't dead),per report from Pan Bian. Add a CHECK_FOR_INTERRUPTS in theinner loop over child relations, because there's little pointin having one in the outer loop if there's not one here too.Minor stylistic adjustments and comment improvements.Seems to be aboriginal to this code (cf commit665d1fa).Back-patch to v10 where that came in, not because any of thisis significant, but just to keep the branches looking similar.Discussion:https://postgr.es/m/15539-06d00ef6b1e2e1bb@postgresql.org
1 parenteeee62d commit9286ef8

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

‎src/backend/commands/publicationcmds.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ RemovePublicationRelById(Oid proid)
494494
}
495495

496496
/*
497-
* Open relationsbased on provided by RangeVar list.
497+
* Open relationsspecified by a RangeVar list.
498498
* The returned tables are locked in ShareUpdateExclusiveLock mode.
499499
*/
500500
staticList*
@@ -509,11 +509,12 @@ OpenTableList(List *tables)
509509
*/
510510
foreach(lc,tables)
511511
{
512-
RangeVar*rv=lfirst(lc);
513-
Relationrel;
512+
RangeVar*rv=castNode(RangeVar,lfirst(lc));
514513
boolrecurse=rv->inh;
514+
Relationrel;
515515
Oidmyrelid;
516516

517+
/* Allow query cancel in case this takes a long time */
517518
CHECK_FOR_INTERRUPTS();
518519

519520
rel=heap_openrv(rv,ShareUpdateExclusiveLock);
@@ -531,13 +532,15 @@ OpenTableList(List *tables)
531532
heap_close(rel,ShareUpdateExclusiveLock);
532533
continue;
533534
}
535+
534536
rels=lappend(rels,rel);
535537
relids=lappend_oid(relids,myrelid);
536538

539+
/* Add children of this rel, if requested */
537540
if (recurse)
538541
{
539-
ListCell*child;
540542
List*children;
543+
ListCell*child;
541544

542545
children=find_all_inheritors(myrelid,ShareUpdateExclusiveLock,
543546
NULL);
@@ -546,18 +549,15 @@ OpenTableList(List *tables)
546549
{
547550
Oidchildrelid=lfirst_oid(child);
548551

549-
if (list_member_oid(relids,childrelid))
550-
continue;
552+
/* Allow query cancel in case this takes a long time */
553+
CHECK_FOR_INTERRUPTS();
551554

552555
/*
553556
* Skip duplicates if user specified both parent and child
554557
* tables.
555558
*/
556559
if (list_member_oid(relids,childrelid))
557-
{
558-
heap_close(rel,ShareUpdateExclusiveLock);
559560
continue;
560-
}
561561

562562
/* find_all_inheritors already got lock */
563563
rel=heap_open(childrelid,NoLock);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp