Bug #3837 sub selects errors when using preprared statements
Submitted: 20 May 2004 11:12 Modified: 31 Aug 2004 17:22
Reporter: laurent chades Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1.1-alpha OS:Linux (Linux Redhat)
Assigned to: Dean Ellis CPU Architecture:Any

[20 May 2004 11:12] laurent chades
Description:
when using prepared statements with the 3.1.1-alpha connector (on a 1.4.1 JDK) subselect queries lead to an SQLException with the following message :

Syntax error or access violation message from server: "select command denied to user: 'root'@'localhost' for column 'login' in table 'user_roles'"

(I used root account to be sure that no permission problem is involved in this error)

the SQL query tha is used for creating the prepared statement is :

SELECT * FROM forums WHERE role IN (SELECT user_roles.role_name AS role_name FROM user_roles WHERE user_roles.login=?) ORDER BY name

I use InnoDB tables.

the excpetion is thrown when the connexion.prepareStatement(mySQLQuery) method is called.

When I was developping my application on a windows machine with MySQL 3.1.0-max-nt and the 3.0.8 connector with 1.4.1 JDK, I didn't met this error

How to repeat:
try to perform a subselect in a prepared statement.

Suggested fix:
this looks like the 2641 bug, but the error I get is a bit different.
[31 Aug 2004 17:22] Dean Ellis
I cannot repeat this using the current development version of Connector/J 3.1 and MySQL 4.1.4.  This could have been an old bug that has been corrected in subsequent releases.  If you are able to repeat this with current snapshots please let us know.
[31 Aug 2004 17:31] laurent chades
I can't reproduce with my own code on the last version I use now (4.1.1 beta)