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

Commitaaf7b3b

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 parent6dc46f8 commitaaf7b3b

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
@@ -470,7 +470,7 @@ RemovePublicationRelById(Oid proid)
470470
}
471471

472472
/*
473-
* Open relationsbased on provided by RangeVar list.
473+
* Open relationsspecified by a RangeVar list.
474474
* The returned tables are locked in ShareUpdateExclusiveLock mode.
475475
*/
476476
staticList*
@@ -485,11 +485,12 @@ OpenTableList(List *tables)
485485
*/
486486
foreach(lc,tables)
487487
{
488-
RangeVar*rv=lfirst(lc);
489-
Relationrel;
488+
RangeVar*rv=castNode(RangeVar,lfirst(lc));
490489
boolrecurse=rv->inh;
490+
Relationrel;
491491
Oidmyrelid;
492492

493+
/* Allow query cancel in case this takes a long time */
493494
CHECK_FOR_INTERRUPTS();
494495

495496
rel=heap_openrv(rv,ShareUpdateExclusiveLock);
@@ -507,13 +508,15 @@ OpenTableList(List *tables)
507508
heap_close(rel,ShareUpdateExclusiveLock);
508509
continue;
509510
}
511+
510512
rels=lappend(rels,rel);
511513
relids=lappend_oid(relids,myrelid);
512514

515+
/* Add children of this rel, if requested */
513516
if (recurse)
514517
{
515-
ListCell*child;
516518
List*children;
519+
ListCell*child;
517520

518521
children=find_all_inheritors(myrelid,ShareUpdateExclusiveLock,
519522
NULL);
@@ -522,18 +525,15 @@ OpenTableList(List *tables)
522525
{
523526
Oidchildrelid=lfirst_oid(child);
524527

525-
if (list_member_oid(relids,childrelid))
526-
continue;
528+
/* Allow query cancel in case this takes a long time */
529+
CHECK_FOR_INTERRUPTS();
527530

528531
/*
529532
* Skip duplicates if user specified both parent and child
530533
* tables.
531534
*/
532535
if (list_member_oid(relids,childrelid))
533-
{
534-
heap_close(rel,ShareUpdateExclusiveLock);
535536
continue;
536-
}
537537

538538
/* find_all_inheritors already got lock */
539539
rel=heap_open(childrelid,NoLock);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp