diff options
author | Leif Madsen <leif@leifmadsen.com> | 2010-07-12 15:37:01 +0000 |
---|---|---|
committer | Leif Madsen <leif@leifmadsen.com> | 2010-07-12 15:37:01 +0000 |
commit | 0c7357c94e45892ba673e3a7c93e7d60a026f8f8 (patch) | |
tree | 9da8f4b4b93eee0f7b0ea98c86a9080b0802d625 /cdr | |
parent | b1b29e521450ba707f49a1ae7575f256f23ddcf0 (diff) |
cdr_pgsql does not detect when a table is found.
This change adds an ERROR message to let you know when a failure exists to
get the columns from the pgsql database, which typically means that the
table does not exist.
(closes issue #17478)
Reported by: kobaz
Patches:
cdr_pgsql.patch uploaded by kobaz (license 834)
Tested by: kobaz, russell, lmadsen
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@275626 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'cdr')
-rw-r--r-- | cdr/cdr_pgsql.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/cdr/cdr_pgsql.c b/cdr/cdr_pgsql.c index 53e957c26..b248a1e75 100644 --- a/cdr/cdr_pgsql.c +++ b/cdr/cdr_pgsql.c @@ -526,6 +526,13 @@ static int config_module(int reload) } rows = PQntuples(result); + if (rows == 0) { + ast_log(LOG_ERROR, "cdr_pgsql: Failed to query database columns. No columns found, does the table exist?\n"); + PQclear(result); + unload_module(); + return AST_MODULE_LOAD_DECLINE; + } + for (i = 0; i < rows; i++) { fname = PQgetvalue(result, i, 0); ftype = PQgetvalue(result, i, 1); |