Skip to content

Commit e6ccd1c

Browse files
committed
Simplify one use of ScanKey in pg_subscription.c
The section of the code in charge of returning all the relations associated to a subscription only need one ScanKey, but allocated two of them. This code was introduced as a copy-paste from a different area on the same file by 7c4f524, making the result confusing to follow. Author: Peter Smith Reviewed-by: Tom Lane, Julien Rouhaud, Bharath Rupireddy Discussion: https://postgr.es/m/CAHut+PsLKe+rN3FjchoJsd76rx2aMsFTB7CTFxRgUP05p=kcpQ@mail.gmail.com
1 parent ec6e70c commit e6ccd1c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/backend/catalog/pg_subscription.c

+3-4
Original file line numberDiff line numberDiff line change
@@ -461,19 +461,18 @@ GetSubscriptionRelations(Oid subid)
461461
List *res = NIL;
462462
Relation rel;
463463
HeapTuple tup;
464-
int nkeys = 0;
465-
ScanKeyData skey[2];
464+
ScanKeyData skey[1];
466465
SysScanDesc scan;
467466

468467
rel = table_open(SubscriptionRelRelationId, AccessShareLock);
469468

470-
ScanKeyInit(&skey[nkeys++],
469+
ScanKeyInit(&skey[0],
471470
Anum_pg_subscription_rel_srsubid,
472471
BTEqualStrategyNumber, F_OIDEQ,
473472
ObjectIdGetDatum(subid));
474473

475474
scan = systable_beginscan(rel, InvalidOid, false,
476-
NULL, nkeys, skey);
475+
NULL, 1, skey);
477476

478477
while (HeapTupleIsValid(tup = systable_getnext(scan)))
479478
{

0 commit comments

Comments
 (0)