From 0d9bb598e8ae01a040f6a2d277c8f221ca782fdf Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Tue, 26 Aug 2008 16:16:55 +0200 Subject: [PATCH] postgresql plugin: Check for and report query redefinitions. Signed-off-by: Sebastian Harl Signed-off-by: Florian Forster --- src/postgresql.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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); -- 2.11.0