diff --git a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c index 60e1f34e97..ff6b6431d1 100644 --- a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c +++ b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c @@ -362,14 +362,14 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) var = tmp; } - if (cdr_field->quote) { - if ((cdr_field->not_null == SWITCH_FALSE) && zstr(var)) { - pq_var = switch_mprintf("null,", var); - } else { - pq_var = switch_mprintf("'%s',", var); - } + if ((cdr_field->not_null == SWITCH_FALSE) && zstr(var)) { + pq_var = switch_mprintf("null,", var); } else { - pq_var = switch_mprintf("%s,", var); + if (cdr_field->quote) { + pq_var = switch_mprintf("'%s',", var); + } else { + pq_var = switch_mprintf("%s,", var); + } } /* Resize values buffer to accomodate next var */