Bug #66573 AGAINST allows variables, documentation says it does not
Submitted: 28 Aug 2012 11:52 Modified: 6 Sep 2012 15:17
Reporter: Sheeri Cabral (Candidate Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.5.27, 5.5.28 OS:Mac OS X
Assigned to: Paul Dubois CPU Architecture:Any
Tags: documentation, qc
Triage: Needs Triage: D3 (Medium)

[28 Aug 2012 11:52] Sheeri Cabral
Description:
The manual page at http://dev.mysql.com/doc/refman/5.5/en/fulltext-restrictions.html

says

" The argument to AGAINST() must be a constant string. "

And the page at http://dev.mysql.com/doc/refman/5.5/en/fulltext-search.html

says

" The search string must be a literal string, not a variable or a column name. "

However, I was able to use a variable in MySQL 5.5

How to repeat:
$ mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3164
Server version: 5.5.27 MySQL Community Server (GPL)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use sakila;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> set @word:="shark";
Query OK, 0 rows affected (0.00 sec)

mysql> select count(title) from film_text where match(description,title) against(@word); 
+--------------+
| count(title) |
+--------------+
|          114 |
+--------------+
1 row in set (0.00 sec)

Suggested fix:
Change the documentation to be more clear (did you mean it can't be a variable in stored code like a procedure/function/event/trigger, but user "@ variables" are OK? or has the variable restriction changed?
[28 Aug 2012 13:05] Valeriy Kravchuk
Thank you for the problem report.
[6 Sep 2012 15:17] Paul Dubois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products.

The expression need not be a literal string, but it must an expression that has a constant value during query evaluation. This permits variables, for example, but rules out column names.