views:

26

answers:

0

I inherited a database application that includes several SQL functions. We recently migrated to another server, and while I thought the move had gone smoothly, I'm getting error reports from users when they call a handful of functions. The functions were there, and looked correct, but eventually I noticed that there is a method parameter being declared with a leading underscore, but on the new server the underscore is gone. Example:

CREATE FUNCTION 'foo'(
  _name VARCHAR(50)
) RETURNS int
BEGIN
   RETURN length(_name);
END

The .sql file that was dumped out of the old database has the underscore, but when I use SHOW CREATE FUNCTION foo it doesn't have the _ in the declaration, only in the later reference. I couldn't figure out where I went wrong -- is it a shell thing, or something to do with how the command-line client interprets input, or a special-character case where something's not getting escaped? I can re-define the function and it works, I'm just trying to figure out how our original (largely automated) pipeline failed.

ETA: This is MySQL (not sure the version, if that matters); AFAIK scripts were created from the old database, then run on the new one using mysql < infile.sql. Again, not actually sure what mechanism was used to create the scripts, but I've read them and the underscore is not missing there.