Bug #34939 key words used as substring in identifiers causing syntax errors
Submitted: 28 Feb 2008 20:01 Modified: 28 Feb 2008 20:36
Reporter: Jim Hardman Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.1.23-rc OS:MacOS
Assigned to: CPU Architecture:Any
Tags: key word, reserved word

[28 Feb 2008 20:01] Jim Hardman
Description:
When a command or function name appears at the last characters of an identifier where the identifier is followed by white space causes a syntax error.

How to repeat:
\d~
DROP FUNCTION IF EXISTS FoundInSet ~
CREATE DEFINER = 'csdev'@'localhost' FUNCTION FoundInSet (
  pSet text,
  pItem varchar(255),
  pDelimiter varchar(5)
-- error on line above
-- placing pDelimiter in back ticks or adding s to end of name fixes problem
)
RETURNS
  boolean
SQL SECURITY DEFINER 
BEGIN

  return InStr(
    Concat(pDelimiter, Replace(pSet, ' ',''), pDelimiter),
-- if back ticks are used as described earlier
-- and if line above is changed to 
-- Concat(pDelimiter , Replace(pSet, ' ',''), pDelimiter),
-- a syntax error will occur on this line
    Concat(pDelimiter, pItem, pDelimiter)
  ) > 0; 

END~
\d;
[28 Feb 2008 20:36] Valeriy Kravchuk
Looks like a duplicate of bug #33812.