Bug #12567 Wrong result of mysql_real_query
Submitted: 13 Aug 2005 10:05 Modified: 9 Nov 2005 12:54
Reporter: Bugs System Email Updates:
Status: Won't fix Impact on me:
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.0.11-beta OS:Windows (Windows XP)
Assigned to: Paul DuBois CPU Architecture:Any

[13 Aug 2005 10:05] Bugs System
I execute the MySQL API function mysql_real_query with two (different) wrong queries - but I get different results:

SELECT Invalid;
=> Result = 1

=> Result = 0

In both cases mysql_errno reports the bug 1054 (ER_BAD_FIELD_ERROR).

How to repeat:
mysql_real_query(Handle, 'EXPLAIN SELECT Invalid;', 23)

Suggested fix:
mysql_real_query(Handle, 'EXPLAIN SELECT Invalid;', 23)
should return
Result = 1
[13 Aug 2005 17:59] Jorge del Conde
Thanks for your bug report.  I was able to reporduce these results using 5.0.11
[15 Aug 2005 15:52] Andrey Hristov
In the command line in both cases the user gets the same error. However whether in a test program which I add or in the command line client both commands return 0 (success) the difference is that later when doing mysql_store_result() an error occurs - 1054.

#include <stdio.h>
#include <mysql.h>

int main()

  MYSQL conn;
  int res= 0;

  mysql_real_connect(&conn, "localhost", "root", "", "test", 3306, NULL, 0);

  res= mysql_query(&conn, "SELECT Invalid;");
  printf("res=%d error_no=%d\n", res, mysql_errno(&conn));

  res= mysql_query(&conn, "EXPLAIN SELECT Invalid;");
  printf("res=%d error_no=%d\n", res, mysql_errno(&conn));

  return 0;
[15 Aug 2005 18:06] MySQL Verification Team

Please test also on Linux and edit the OS field if also happens on it.

[22 Sep 2005 6:44] Jorge del Conde
This also happens in Linux - FC4
[8 Nov 2005 14:13] MySQL-Front Team
The developers are not interessed about our bug messages.