Google analytics code

Monday, December 7, 2009

MySQL: Error 1305 - Function xxx does not exist

I ran into an odd issue on a project I updated awhile ago. I updated an existing sql statement to include IFNULL for an exclusion check. It worked fine on my dev machine, but caused an issue on the production machine.

The version of MySQL on my dev machine was a little bit newer than production so the issue never came up. Here is the error the sql server returned:
#1305 - FUNCTION [DATABASE_NAME].ifnull does not exist

Here is a little bit of the sql that caused the error:
AND IFNULL ( `tbl_category_admin`.`admin_key_id` =5, true )

The problem was caused by the space between IFNULL and (. Changing it to IFNULL( solved the problem. If you run into an issue where MySQL returns an error saying a given function does not exist look for spaces between the function and the "(".

32 comments:

  1. That just happened to me. Thanks to you and Google, I was able to fix it in 5 minutes...

    Jan

    ReplyDelete
  2. Just encountered this exact same issue. Thanks for sharing.

    ReplyDelete
  3. Thank you very much. I have also had this problem with the CONCAT function. Deleting those spaces between 'CONCAT' and '(' worked for me as well.

    ReplyDelete
  4. Thanks.

    'look for spaces between the function and the "(" ' - this solved the problem for me also.

    ReplyDelete
  5. thanks man !! thats one of these things that you can spend a whole night stucking your head on the table ;-) you just saved my precious time..

    ReplyDelete
  6. THX mate ! 5 seconds of searching, and i though something is wrong with my pythons library ^^

    ReplyDelete
  7. Thank you.
    Happend to my with version '5.0.77-log' (production server)
    but not with '5.1.37-1ubuntu5.4' (development server)

    ReplyDelete
  8. Thanks buddy, you saved my time.

    ReplyDelete
  9. Thank you very much!

    ReplyDelete
  10. Train's is not stopping. Same problem.
    I was about to reinstall whole MySQL :D
    Thank you!

    ReplyDelete
  11. oh wow, you just saved me endless frustration.
    Had it on the dev->production move aswell

    ReplyDelete
  12. Thank you so much, i was ready to kill myself but then i found your blog.

    ReplyDelete
  13. select newtime(if(new_event.newtime>160000, 2 , if(new_event.newtime>80000, 1, 0))) from new_event;


    the above code is giving me the 1305 error code. can u help me

    ReplyDelete
  14. @anonymous the probably there is that function doesn't exist at all. Here is the page with all the time functions for mysql
    http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html

    ReplyDelete
  15. After about 60 minutes of trying to figure out what the hel.. was going on...

    Good lookin out...

    ReplyDelete
  16. Thank you so much!!

    ReplyDelete
  17. You can't imagine how thankfull I am!

    Hail to you!

    ReplyDelete
  18. thanks a ton man !! you saved my another day, have no words to thank you more :)

    ReplyDelete
  19. Oooh thank you! You saved me time and hair :)

    ReplyDelete
  20. Same here. Thanks.

    ReplyDelete
  21. Thanks so much! Without this page I'd never have found it!

    ReplyDelete
  22. awesome man !! you are saviour :)

    ReplyDelete
  23. You sir are true hero. Thank you.

    ReplyDelete
  24. Eres un genio, gracias por la ayuda !!!!

    ReplyDelete
  25. Muito obrigado, já tinha gasto uma hora a procura da solução!

    Thank you

    ReplyDelete
  26. finally after a few hours googled..thanks so much..

    ReplyDelete
  27. Also, check on syntax error guys. I was doing a concatenation of multiple substr and reason for error was that one of the substr was written wrongly as "subtr"

    ReplyDelete

If you found this page useful, or you have any feedback, please leave a comment.