Summary:ASTERISK-14148: Null fields do not get stored as null in mysql
Reporter:John S. (johnakabean)Labels:
Date Opened:2009-05-16 19:36:46Date Closed:2011-06-07 14:08:13
Versions:Frequency of
Description:If a field, such as account code, has nothing to input, asterisk stores it as something NOT Null; this issue is with ALL fields asterisk uses in storing the cdr in mysql but I have not seen if the problem originates in the cdr generator backend itself or in the mysql addon module.
Comments:By: Tilghman Lesher (tilghman) 2009-05-18 07:04:43

That's a function of the CDR fields.  All of the standard fields in Asterisk are empty strings by default, not NULL, so MySQL is correctly logging this fact.  Only non-standard fields can ever be set NULL.  Also, non-standard fields are only supported in this backend, starting in version 1.6.0.

By: John S. (johnakabean) 2009-05-19 20:25:33

This is a major issue in effectively optimizing mysql queries; by only pulling the calls needing to be billed, for example, it reduces latency in mysql queries on a high-load system.

I tried changing the structure of the table in mysql in hopes that something stored as a space, or whatever is being stored by asterrisk, will be interpreted by mysql as null; it does not make a difference.

By: Tilghman Lesher (tilghman) 2009-05-20 18:55:10

Again, this is NOT a bug.  The fields are blank in Asterisk and are correctly stored as blank in MySQL.