Bug #8535 Federated Test fails on selecting NULLs in a WHERE clause
Submitted: 16 Feb 2005 6:57 Modified: 5 Apr 2005 21:31
Reporter: Patrick Galbraith Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version: OS:Linux (Linux, SuSe 8.x)
Assigned to: Bugs System CPU Architecture:Any

[16 Feb 2005 6:57] Patrick Galbraith
Description:
Upon the latest bk pull (February 15th) federated test suite now fails. Upon reviewing this, it appears there has been some change that makes WHERE clause generation fail when it involves NULLs. Investigating further... Note: no changes have been made to the federated code.

How to repeat:
./mysql-test-run --debug federated. From mysql-test/, view var/log/slave.log and see that the queries on the foreign database are incorrect.

Suggested fix:
see where the WHERE clause is being improperly created using the slave.log and trace file.
[16 Feb 2005 7:21] Patrick Galbraith
The problem is that Field::quote_data was being called after the if else block:

if ((*field)->is_null())
  insert_field_value_string.append("NULL");
else
  (*field)->val_str(&insert_field_value_string);

(*field)->quote_data(&insert_field_value_string);

Resulting in NULL being quoted on the insert statement on the foreign database, so literal NULLs were being inserted. Whatever change in the core code that broke this was fortunate, because the new behaviour is correct ;)

Now, this is done:

if ((*field)->is_null())
{
  insert_field_value_string.append("NULL");
}
else
{
  (*field)->val_str(&insert_field_value_string);
  (*field)->quote_data(&insert_field_value_string);
}

I will commit this fix tomorrow.
[17 Feb 2005 18:17] Patrick Galbraith
changeset 1.1856 fixes this, awaiting review. Ingo has reviewed, with minor modifications needed. Waiting for second review.
[5 Apr 2005 21:31] Patrick Galbraith
This has been fixed in 5.0.3