mirror of
https://github.com/postgres/postgres.git
synced 2025-07-26 01:22:12 +03:00
pgstat: add pg_stat_have_stats() test helper.
Will be used by tests committed subsequently. Bumps catversion (this time for real, the one in0f96965c65
got lost when rebasing over5c279a6d35
). Author: Melanie Plageman <melanieplageman@gmail.com> Discussion: https://postgr.es/m/CAAKRu_aNxL1WegCa45r=VAViCLnpOU7uNC7bTtGw+=QAPyYivw@mail.gmail.com
This commit is contained in:
@ -2394,3 +2394,21 @@ pg_stat_get_subscription_stats(PG_FUNCTION_ARGS)
|
||||
/* Returns the record as Datum */
|
||||
PG_RETURN_DATUM(HeapTupleGetDatum(heap_form_tuple(tupdesc, values, nulls)));
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks for presence of stats for object with provided kind, database oid,
|
||||
* object oid.
|
||||
*
|
||||
* This is useful for tests, but not really anything else. Therefore not
|
||||
* documented.
|
||||
*/
|
||||
Datum
|
||||
pg_stat_have_stats(PG_FUNCTION_ARGS)
|
||||
{
|
||||
char *stats_type = text_to_cstring(PG_GETARG_TEXT_P(0));
|
||||
Oid dboid = PG_GETARG_OID(1);
|
||||
Oid objoid = PG_GETARG_OID(2);
|
||||
PgStat_Kind kind = pgstat_get_kind_from_str(stats_type);
|
||||
|
||||
PG_RETURN_BOOL(pgstat_have_entry(kind, dboid, objoid));
|
||||
}
|
||||
|
Reference in New Issue
Block a user