Bug #10724 Incorrect column headers returned when using @@local to reference a variable
Submitted: 19 May 2005 3:02 Modified: 7 Aug 2005 2:54
Reporter: Harrison Fisk
Status: Closed
Category:Server Severity:S3 (Non-critical)
Version:4.1.12 OS:Microsoft Windows (Windows XP)
Assigned to: Jim Winstead Target Version:

[19 May 2005 3:02] Harrison Fisk
Description:
If you use the @@local.variable syntax in a query, the column headers instead come back
as @@session.variable.  They should come back as @@local, since that is what you gave in
the query.

How to repeat:
mysql> select @@local.max_allowed_packet;
+------------------------------+
| @@session.max_allowed_packet |
+------------------------------+
|                      1048576 |
+------------------------------+
1 row in set (0.00 sec)

Suggested fix:
The column header should not be changed and should instead return exactly what is passed
in (in this case it should return @@local.max_allowed_packet).
[19 May 2005 4:14] Miguel Solorzano
c:\mysql\bin>mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.13-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select @@local.max_allowed_packet;
+------------------------------+
| @@session.max_allowed_packet |
+------------------------------+
|                      1048576 |
+------------------------------+
1 row in set (0.13 sec)

miguel@hegel:~/dbs/4.1$ bin/mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 4.1.13-debug-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select @@local.max_allowed_packet;
+------------------------------+
| @@session.max_allowed_packet |
+------------------------------+
|                      1047552 |
+------------------------------+
1 row in set (0.00 sec)
[25 May 2005 2:17] Jim Winstead
This needs a ruling from our standards czars.

Related to this, the case of the session/global/local specifier is not preserved, and
@@version (@@global.version, etc) is especially strange -- it is always named @@VERSION.
[16 Jun 2005 2:34] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/26050
[29 Jun 2005 13:21] Magnus Blaudd
Approved.
[25 Jul 2005 20:25] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/27561
[2 Aug 2005 4:23] Jim Winstead
Fixed in 4.1.14 and 5.0.11.
[7 Aug 2005 2:54] Mike Hillyer
Documented in 4.1.14 and 5.0.11 changelogs:

<listitem><para>
 <literal>SELECT @@local...</literal> returned <literal>@@session...</literal> in the
column header. (Bug #10724)
</para></listitem>