Kamailio version 4.4.2.
Consider this logic: $avp(s:testvar) = 'test'; avp_db_query("select value from test where id = 1","$avp(s:testvar)");
I don't know if this is intended behaviour. If row exists but "value" field is empty (not NULL), $avp(s:testvar) still seems to contain 'test' as value after the query. I think it should be ''.
This can be confusing.
Closed #792.
The avps are not single value variables, but a linked list. Practically it adds to the list whenever there is an assignment (in config or inside a function). It requires to empty the list yourself in the config if you expect some operations to add there and you don't want old values to remain.
In many cases I use avp_db_query() to load from different tables and store in same avp name.
So it is not a bug, but a design decision. If you want to discuss more, this should be dine on sr-users mailing lists to get more opinions...