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

Commit6bc8193

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 parent4c6d6ac commit6bc8193

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
@@ -484,7 +484,7 @@ RemovePublicationRelById(Oid proid)
484484
}
485485

486486
/*
487-
* Open relationsbased on provided by RangeVar list.
487+
* Open relationsspecified by a RangeVar list.
488488
* The returned tables are locked in ShareUpdateExclusiveLock mode.
489489
*/
490490
staticList*
@@ -499,11 +499,12 @@ OpenTableList(List *tables)
499499
*/
500500
foreach(lc,tables)
501501
{
502-
RangeVar*rv=lfirst(lc);
503-
Relationrel;
502+
RangeVar*rv=castNode(RangeVar,lfirst(lc));
504503
boolrecurse=rv->inh;
504+
Relationrel;
505505
Oidmyrelid;
506506

507+
/* Allow query cancel in case this takes a long time */
507508
CHECK_FOR_INTERRUPTS();
508509

509510
rel=heap_openrv(rv,ShareUpdateExclusiveLock);
@@ -521,13 +522,15 @@ OpenTableList(List *tables)
521522
heap_close(rel,ShareUpdateExclusiveLock);
522523
continue;
523524
}
525+
524526
rels=lappend(rels,rel);
525527
relids=lappend_oid(relids,myrelid);
526528

529+
/* Add children of this rel, if requested */
527530
if (recurse)
528531
{
529-
ListCell*child;
530532
List*children;
533+
ListCell*child;
531534

532535
children=find_all_inheritors(myrelid,ShareUpdateExclusiveLock,
533536
NULL);
@@ -536,18 +539,15 @@ OpenTableList(List *tables)
536539
{
537540
Oidchildrelid=lfirst_oid(child);
538541

539-
if (list_member_oid(relids,childrelid))
540-
continue;
542+
/* Allow query cancel in case this takes a long time */
543+
CHECK_FOR_INTERRUPTS();
541544

542545
/*
543546
* Skip duplicates if user specified both parent and child
544547
* tables.
545548
*/
546549
if (list_member_oid(relids,childrelid))
547-
{
548-
heap_close(rel,ShareUpdateExclusiveLock);
549550
continue;
550-
}
551551

552552
/* find_all_inheritors already got lock */
553553
rel=heap_open(childrelid,NoLock);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp