aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_config_pgsql.c
diff options
context:
space:
mode:
Diffstat (limited to 'res/res_config_pgsql.c')
-rw-r--r--res/res_config_pgsql.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c
index 14146e330..38d38e345 100644
--- a/res/res_config_pgsql.c
+++ b/res/res_config_pgsql.c
@@ -296,7 +296,7 @@ static char *decode_chunk(char *chunk)
char *orig = chunk;
for (; *chunk; chunk++) {
if (*chunk == '^' && strchr("0123456789ABCDEFabcdef", chunk[1]) && strchr("0123456789ABCDEFabcdef", chunk[2])) {
- sscanf(chunk + 1, "%02hhd", chunk);
+ sscanf(chunk + 1, "%02hhX", chunk);
memmove(chunk + 1, chunk + 3, strlen(chunk + 3) + 1);
}
}
@@ -1191,9 +1191,16 @@ static int require_pgsql(const char *database, const char *tablename, va_list ap
size, column->type);
res = -1;
}
- } else if (strncmp(column->type, "float", 5) == 0 && !ast_rq_is_int(type) && type != RQ_FLOAT) {
- ast_log(LOG_WARNING, "Column %s cannot be a %s\n", column->name, column->type);
- res = -1;
+ } else if (strncmp(column->type, "float", 5) == 0) {
+ if (!ast_rq_is_int(type) && type != RQ_FLOAT) {
+ ast_log(LOG_WARNING, "Column %s cannot be a %s\n", column->name, column->type);
+ res = -1;
+ }
+ } else if (strncmp(column->type, "timestamp", 9) == 0) {
+ if (type != RQ_DATETIME && type != RQ_DATE) {
+ ast_log(LOG_WARNING, "Column %s cannot be a %s\n", column->name, column->type);
+ res = -1;
+ }
} else { /* There are other types that no module implements yet */
ast_log(LOG_WARNING, "Possibly unsupported column type '%s' on column '%s'\n", column->type, column->name);
res = -1;