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
This commit is contained in:
parent
ec6e70c79f
commit
e6ccd1ce16
@ -461,19 +461,18 @@ GetSubscriptionRelations(Oid subid)
|
|||||||
List *res = NIL;
|
List *res = NIL;
|
||||||
Relation rel;
|
Relation rel;
|
||||||
HeapTuple tup;
|
HeapTuple tup;
|
||||||
int nkeys = 0;
|
ScanKeyData skey[1];
|
||||||
ScanKeyData skey[2];
|
|
||||||
SysScanDesc scan;
|
SysScanDesc scan;
|
||||||
|
|
||||||
rel = table_open(SubscriptionRelRelationId, AccessShareLock);
|
rel = table_open(SubscriptionRelRelationId, AccessShareLock);
|
||||||
|
|
||||||
ScanKeyInit(&skey[nkeys++],
|
ScanKeyInit(&skey[0],
|
||||||
Anum_pg_subscription_rel_srsubid,
|
Anum_pg_subscription_rel_srsubid,
|
||||||
BTEqualStrategyNumber, F_OIDEQ,
|
BTEqualStrategyNumber, F_OIDEQ,
|
||||||
ObjectIdGetDatum(subid));
|
ObjectIdGetDatum(subid));
|
||||||
|
|
||||||
scan = systable_beginscan(rel, InvalidOid, false,
|
scan = systable_beginscan(rel, InvalidOid, false,
|
||||||
NULL, nkeys, skey);
|
NULL, 1, skey);
|
||||||
|
|
||||||
while (HeapTupleIsValid(tup = systable_getnext(scan)))
|
while (HeapTupleIsValid(tup = systable_getnext(scan)))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user