git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ec6e70c)
Simplify one use of ScanKey in pg_subscription.c
2021年5月12日 05:54:02 +0000 (14:54 +0900)
2021年5月12日 05:54:02 +0000 (14:54 +0900)
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


diff --git a/src/backend/catalog/pg_subscription.c b/src/backend/catalog/pg_subscription.c
index 4039768865194721a9adfea600bf7255c0a6d4cd..7db1f7df08ca0ed6efa1555bf06cc885e28c4780 100644 (file)
--- a/src/backend/catalog/pg_subscription.c
+++ b/src/backend/catalog/pg_subscription.c
@@ -461,19 +461,18 @@ GetSubscriptionRelations(Oid subid)
List *res = NIL;
Relation rel;
HeapTuple tup;
- int nkeys = 0;
- ScanKeyData skey[2];
+ ScanKeyData skey[1];
SysScanDesc scan;
rel = table_open(SubscriptionRelRelationId, AccessShareLock);
- ScanKeyInit(&skey[nkeys++],
+ ScanKeyInit(&skey[0],
Anum_pg_subscription_rel_srsubid,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(subid));
scan = systable_beginscan(rel, InvalidOid, false,
- NULL, nkeys, skey);
+ NULL, 1, skey);
while (HeapTupleIsValid(tup = systable_getnext(scan)))
{
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /