From: Sebastian Harl Date: Tue, 26 Aug 2008 14:16:55 +0000 (+0200) Subject: postgresql plugin: Check for and report query redefinitions. X-Git-Tag: collectd-4.5.0~28 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=0d9bb598e8ae01a040f6a2d277c8f221ca782fdf;p=collectd.git postgresql plugin: Check for and report query redefinitions. Signed-off-by: Sebastian Harl Signed-off-by: Florian Forster --- diff --git a/src/postgresql.c b/src/postgresql.c index 409a5de3..9438c576 100644 --- a/src/postgresql.c +++ b/src/postgresql.c @@ -774,6 +774,20 @@ static int c_psql_config_query (oconfig_item_t *ci) log_warn ("Ignoring unknown config key \"%s\".", c->key); } + for (i = 0; i < queries_num - 1; ++i) { + c_psql_query_t *q = queries + i; + + if ((0 == strcasecmp (q->name, query->name)) + && (q->min_pg_version <= query->max_pg_version) + && (query->min_pg_version <= q->max_pg_version)) { + log_err ("Ignoring redefinition (with overlapping version ranges) " + "of query \"%s\".", query->name); + c_psql_query_delete (query); + --queries_num; + return 1; + } + } + if (query->min_pg_version > query->max_pg_version) { log_err ("Query \"%s\": MinPGVersion > MaxPGVersion.", query->name);