Bug #53289 connector/c Test 8:60 failes on a mysql 5.0 server
Submitted: 29 Apr 2010 15:26 Modified: 10 Feb 2011 17:30
Reporter: Joe Grasse Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / C Severity:S3 (Non-critical)
Version:6.0.2 OS:Any
Assigned to: Georg Richter CPU Architecture:Any

[29 Apr 2010 15:26] Joe Grasse
Description:
When running ctest after building connector/c, test 8:60 sqlmode fails on a 5.0 myql server. This is because of line 4352 in file unittest/libmysql/ps.c. Without changing the sql_mode variable some functions can not be called with spaces after the function name. This test is trying to run "SELECT connection_id    ()" without turning on sql_mode=IGNORE_SPACE. It looks like the behavior for this function (connection_id) has changed in mysql 5.1, maybe because of bug #22619.

How to repeat:
Run ctest against mysql 5.0.90

Suggested fix:
Change the first call to "SELECT connection_id    ()" to "SELECT connection_id()" in function test_sqlmode on line 4352 in file unittest/libmysql/ps.c.
[27 May 2010 19:56] Sveta Smirnova
Thank you for the report.

Verified as described by reading source code.
[7 Jan 2011 11:16] Ulf Wendel
I don't think the SQL mode should be touched. This looks like some funny we-use-libmysql-to-test-server-features legacy test. A little later in the test the SQL mode is altered.

We should rather add a version check and leave SQL mode logic as is.

nixnutz@linux-fuxh:~/src/1.0> bzr diff
=== modified file 'unittest/libmysql/ps.c'
--- unittest/libmysql/ps.c      2010-09-23 07:11:46 +0000
+++ unittest/libmysql/ps.c      2011-01-07 11:10:56 +0000
@@ -4357,7 +4357,11 @@
   rc= mysql_query(mysql, "DELETE FROM test_piping");
   check_mysql_rc(rc, mysql);

-  strcpy(query, "SELECT connection_id    ()");
+  if (mysql_get_server_version(mysql) < 50114)
+    strcpy(query, "SELECT connection_id    ()");
+  else
+    strcpy(query, "SELECT connection_id()");
+
   stmt= mysql_stmt_init(mysql);
   FAIL_IF(!stmt, mysql_error(mysql));
   rc= mysql_stmt_prepare(stmt, query, strlen(query));
[1 Feb 2011 7:33] Georg Richter
Fixed in 6.0.3
[10 Feb 2011 17:30] Tony Bedford
An entry has been added to the 6.0.3 changelog:

When running ctest after building MySQL Connector/C, test 8:60 sqlmode failed when using MySQL Server 5.0.