Bug #33637 SHOW PROCEDURE CODE/SHOW FUNCTION CODE sp_name gives a syntax error.
Submitted: 2 Jan 2008 21:39 Modified: 12 Nov 2009 19:05
Reporter: Anatoly Pidruchny (Candidate Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version:5.1.22 OS:Any
Assigned to: Marc Alff CPU Architecture:Any

[2 Jan 2008 21:39] Anatoly Pidruchny
Description:
According to http://dev.mysql.com/doc/refman/5.1/en/show-procedure-code.html, the statement SHOW PROCEDURE CODE is only supported "for servers that have been built with debugging support". But the command HELP SHOW shows these commands as available. If I try to run any of them, I am getting a syntax error:

mysql> help show;
...
SHOW FUNCTION CODE sp_name
...
SHOW PROCEDURE CODE sp_name
...
mysql> show procedure code xxx;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

How to repeat:
Please see the description.

Suggested fix:
Either do not show these command by the HELP SHOW command, or give a better error message. The error message should say that the command is only available for servers that have been built with debugging support.
[4 Jan 2008 14:49] Susanne Ebrecht
Many thanks for writing a bug report.

This is not a bug.

If you just type:

mysql> \h show
or mysql> help show;

You will get a list of all theoretical, possible combinations with show.

If you type:

mysql> \h show procedure code

You will get these explanation:

"These statements are MySQL extensions that are available only for
servers that have been built with debugging support."

When you use the help or \h command for getting informations for SQL commandos, you always have to ask for the whole commando, when you want to get all informations about it.
[4 Jan 2008 15:01] Sergei Golubchik
Actually, I agree with the reporter, I think that ER_FEATURE_DISABLED ("The '%s' feature is disabled; you need MySQL built with '%s' to have it working") would be more appropriate here.
[24 Jul 2008 2:01] Paul Dubois
There is no bug here. The content of the help tables is built from the reference manual, which covers both debug and non-debug versions of the server. (That is, we don't have one version of the manual for debug servers, and another version for non-debug servers.) Anyway, the output of HELP is correct. It says the statements are supported only for debug servers, which is true.
[24 Jul 2008 2:04] Paul Dubois
Addendum: My previous comment should not be taken to imply that the error message cannot or should not be improved.
[24 Jul 2008 15:13] Anatoly Pidruchny
Paul, the suggested fix is not to change the error message text for the error 1064 (ER_PARSE_ERROR), but to recognize the syntax of these two commands in non-debug version of the server and return the appropriate error code ER_FEATURE_DISABLED (as Sergei suggested), or may be a new error code for this case. The problem with non-debug version of the server is that it looks like it does not recognize the syntax at all.
[24 Jul 2008 16:50] 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/commits/50440

2740 Marc Alff	2008-07-24
      Bug#33637 (SHOW PROCEDURE CODE/SHOW FUNCTION CODE sp_name gives a syntax
      error.)
      
      In non debug builds, the statements:
      - SHOW PROCEDURE CODE
      - SHOW FUNCTION CODE
      used to fail with a "syntax error", which is misleading.
      
      These statements have been changed to return the following error for non
      debug builds:
      ERROR HY000: The 'SHOW PROCEDURE|FUNCTION CODE' feature is disabled; you
      need MySQL built with '--with-debug' to have it working
      
      For debug builds (./configure --with-debug), nothing is changed.
[11 Aug 2008 14:56] 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/commits/51322

2765 Davi Arnaut	2008-08-11 [merge]
      Merge mysql-6.0-bugteam into mysql-6.0 main.
[12 Aug 2008 14:19] 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/commits/51420

2765 Davi Arnaut	2008-08-12 [merge]
      Merge mysql-6.0-bugteam into mysql-6.0 main.
[12 Aug 2008 14:26] 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/commits/51423

2765 Davi Arnaut	2008-08-12 [merge]
      Merge mysql-6.0-bugteam into mysql-6.0 main.
[12 Aug 2008 14:59] Bugs System
Pushed into 6.0.7-alpha  (revid:marc.alff@sun.com-20080724165018-2pbbzcgm4lfc76do) (version source revid:davi.arnaut@sun.com-20080812141852-8e6knbqclpfd8irn) (pib:3)
[12 Aug 2008 17:38] Paul Dubois
Noted in 6.0.7 changelog.

The SHOW FUNCTION CODE and SHOW PROCEDURE CODE statements are not
present in non-debug builds, but attempting to use them resulted in a
syntax error message. Now the error message indicates that the statements
are disabled and that you must use a debug build.
[14 Aug 2008 7:33] 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/commits/51602

2684 He Zhenxing	2008-08-14 [merge]
      Merge 6.0 -> 6.0-rpl-testfixes
[14 Aug 2008 7:36] 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/commits/51603

2684 He Zhenxing	2008-08-14 [merge]
      Merge 6.0 -> 6.0-rpl-testfixes
[28 Aug 2008 20:15] Bugs System
Pushed into 6.0.7-alpha  (revid:cbell@mysql.com-20080822132131-uveo6wiuecy6m2b8) (version source revid:cbell@mysql.com-20080822132131-uveo6wiuecy6m2b8) (pib:3)
[13 Sep 2008 19:57] Bugs System
Pushed into 6.0.6-alpha  (revid:marc.alff@sun.com-20080724165018-2pbbzcgm4lfc76do) (version source revid:sergefp@mysql.com-20080611231653-nmuqmw6dedjra79i) (pib:3)
[29 Oct 2009 16:53] 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/commits/88630

2932 Marc Alff	2009-10-29
      Bug#33637 SHOW PROCEDURE CODE/SHOW FUNCTION CODE sp_name gives a syntax error.
      
      Backport for 5.5
      
      In non debug builds, the statements:
      - SHOW PROCEDURE CODE
      - SHOW FUNCTION CODE
      used to fail with a "syntax error", which is misleading.
      
      These statements have been changed to return the following error for non
      debug builds:
      ERROR HY000: The 'SHOW PROCEDURE|FUNCTION CODE' feature is disabled; you
      need MySQL built with '--with-debug' to have it working
      
      For debug builds (./configure --with-debug), nothing is changed.
[31 Oct 2009 8:20] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20091031081410-qkxmjsdzjmj840aq) (version source revid:marc.alff@sun.com-20091029213317-ct3xfflphozct2r8) (merge vers: 6.0.14-alpha) (pib:13)
[31 Oct 2009 17:32] Paul Dubois
Already fixed in 6.0.7.

Setting report to NDI pending push to 5.5.x
[4 Nov 2009 18:51] Marc Alff
Merged in 5.5.0, in mysql-next-mr
[5 Nov 2009 1:49] Paul Dubois
Noted in 5.5.0 changelog.
[12 Nov 2009 8:17] Bugs System
Pushed into 5.5.0-beta (revid:alik@sun.com-20091110093229-0bh5hix780cyeicl) (version source revid:mikael@mysql.com-20091102100915-a2nbfxaqprpgptfw) (merge vers: 5.5.0-beta) (pib:13)