src/backend/catalog/pg_subscription.c
int
CountDBSubscriptions(Oid dbid)
{
	int				nsubs = 0;
	Relation		rel;
	ScanKeyData		scankey;
	SysScanDesc		scan;
	HeapTuple		tup;

	rel = heap_open(SubscriptionRelationId, RowExclusiveLock);

	ScanKeyInit(&scankey,
				Anum_pg_subscription_subdbid,
				BTEqualStrategyNumber, F_OIDEQ,
				ObjectIdGetDatum(dbid));

	scan = systable_beginscan(rel, InvalidOid, false,
							  NULL, 1, &scankey);

	while (HeapTupleIsValid(tup = systable_getnext(scan)))
		nsubs++;

	systable_endscan(scan);

	heap_close(rel, NoLock);

	return nsubs;
}
/*
 * Return number of subscriptions defined in given database.
 * Used by dropdb() to check if database can indeed be dropped.
 */
Return number of subscriptions defined in given database.
Used by dropdb() to check if database can indeed be dropped.
Return number of subscriptions defined in given database . Used by dropdb () to check if database can indeed be dropped .
int
CountDBSubscriptions(Oid dbid)
{
	int				nsubs = 0;
	Relation		rel;
	ScanKeyData		scankey;
	SysScanDesc		scan;
	HeapTuple		tup;
	rel = heap_open(SubscriptionRelationId, RowExclusiveLock);
	ScanKeyInit(&scankey,
				Anum_pg_subscription_subdbid,
				BTEqualStrategyNumber, F_OIDEQ,
				ObjectIdGetDatum(dbid));
	scan = systable_beginscan(rel, InvalidOid, false,
							  NULL, 1, &scankey);
	while (HeapTupleIsValid(tup = systable_getnext(scan)))
		nsubs++;
	systable_endscan(scan);
	heap_close(rel, NoLock);
	return nsubs;
}
int CountDBSubscriptions ( Oid dbid ) { int nsubs = 0 ; Relation rel ; ScanKeyData scankey ; SysScanDesc scan ; HeapTuple tup ; rel = heap_open ( SubscriptionRelationId , RowExclusiveLock ) ; ScanKeyInit ( & scankey , Anum_pg_subscription_subdbid , BTEqualStrategyNumber , F_OIDEQ , ObjectIdGetDatum ( dbid ) ) ; scan = systable_beginscan ( rel , InvalidOid , false , NULL , 1 , & scankey ) ; while ( HeapTupleIsValid ( tup = systable_getnext ( scan ) ) ) nsubs ++ ; systable_endscan ( scan ) ; heap_close ( rel , NoLock ) ; return nsubs ; }
Return number of subscriptions defined in given database.
Return number of subscriptions defined in given database .