Page 1 of 1

mysql error on 2 queries need some input.

PostPosted: Thu Oct 11, 2012 4:36 pm
by callcrazy
In vdc_db_query.php on our production version and I've also checked the latest downloadable version I see 2 instances of the same query.

Code: Select all
$stmt="UPDATE vicidial_log set status='$dispo_choice' where lead_id='$lead_id' and user='$user' and call_date > \"$four_hours_ago\"
order by uniqueid desc limit 1;";


This is found around line #'s 4934 & 5040.

I'm not sure how often this query executes or why exactly it's being executed but I notice in the vicidial_mysql_errors.txt file errors as follows:

Code: Select all
vicidial_mysql_errors.txt:54245:2012-10-10 18:42:35|vdc_db_query|00145|1242|Subquery returns more than 1 row|UPDATE vicidial_log set status='XX' where lead_id='1219179' and user='xxxxxx' and call_date > "2012-10-10 14:42:35" order by uniqueid desc limit 1;|xxxxxx|10.0.0.100|1349905235_226default15195830|


Most likely not an issue for vicidial, however, we've recently implemented replication and this error is giving us a mismatch between master and slave.

Is this query needed as is?
How would I prevent it from returning Subquery returns more than 1 row errors?
Why does it have "call_date > 4 hours ago?" when also using a limit 1.

Thanks,

CallCrazy

Re: mysql error on 2 queries need some input.

PostPosted: Mon Oct 15, 2012 9:28 am
by callcrazy
Subquery returns more than 1 row. But there isn't a subquery being referenced. This was caused by a trigger that added data to another table that also had a trigger and the second trigger did contain a subquery. Subquery modified and issue resolved.

Re: mysql error on 2 queries need some input.

PostPosted: Mon Oct 15, 2012 7:57 pm
by williamconley
callcrazy wrote:Subquery returns more than 1 row. But there isn't a subquery being referenced. This was caused by a trigger that added data to another table that also had a trigger and the second trigger did contain a subquery. Subquery modified and issue resolved.

Wow. You have a deep system. I do not envy you when you try to upgrade to a later version. LOL

Excellent postback, though. 8-)