Bug #13998 DATEDIFF crashes while calculating difference between NOW and 1947-08-15
Submitted: 13 Oct 2005 9:13 Modified: 13 Oct 2005 9:18
Reporter: Nik T Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.14-standard OS:Linux (linux redhat 9)
Assigned to: CPU Architecture:Any

[13 Oct 2005 9:13] Nik T
Description:
I use phpmyadmin 2.6.3-pl1, I wanted to calculate the difference between NOW()  that is today 13th Oct 2005 2.42 pm and 1947-08-15, upon hitting go, i get the below pasted text 
----------------------------------------------------------------------------------------------------------------

There is a chance that you may have found a bug in the SQL parser. Please examine your query closely, and check that the quotes are correct and not mis-matched. Other possible failure causes may be that you are uploading a file with binary outside of a quoted text area. You can also try your query on the MySQL command line interface. The MySQL server error output below, if there is any, may also help you in diagnosing the problem. If you still have problems or if the parser fails where the command line interface succeeds, please reduce your SQL query input to the single query that causes problems, and submit a bug report with the data chunk in the CUT section below:
----BEGIN CUT----
eNodjk1ugzAYBfc+xbfIIpGw4x+g4B0iTopkMMU0kbqjgqpIFFFIqnTHNXqNHiknKen6jWaeKgpT
SIgZxBy0yiRwAdwFESJbLsOMUHy0ElZJLWH67IZqnJqRdO0rGd4H5ws4ES7hhAGn1NtSfysoMF96
gWQMuuYjBHUdYIXSb/ukJbiEESbwdK76uhpr9GwLMNaB6KCy0oGjWpqntofUvCRaR+ARivI0Wm4R
nwg8dAzlj/mdc4y961xCQbf95Yp0lB0kND2+nN9wgP5zVmkVl7CLSrVL9vt1Zk7rjXObf1joPmAa
YObd5t/NH3KlRTs=
----END CUT----
----BEGIN RAW----

ERROR: C1 C2 LEN: 23 24 39
STR: �

CVS: $Id: sqlparser.lib.php,v 2.34.2.1 2005/06/30 16:58:11 lem9 Exp $
MySQL: 4.1.13-standard
USR OS, AGENT, VER: Win MOZILLA 5.0
PMA: 2.6.3-pl1
PHP VER,OS: 4.4.0 Linux
LANG: en-utf-8
SQL: SELECT DATEDIFF(NOW(),’1947-08-15′)

----END RAW----

SQL query: Documentation

SELECT DATEDIFF(NOW(),’1947-08-15′)

MySQL said: Documentation
#1054 - Unknown column '’1947' in 'field list' 

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

How to repeat:
SELECT DATEDIFF(NOW(),’1947-08-15′)

Suggested fix:
It should give me the difference in days
[13 Oct 2005 9:16] Nik T
I figured out the mistake in the query, it was a ` instead of a ', sorry.
[13 Oct 2005 9:18] Hartmut Holzgraefe
You are using backtick quotes ` around the date that are reserved for table name quoting,
for strings you have to use regular single ' or double " quotes (single quotes if you want to
write portable SQL)
[13 Oct 2005 9:20] Nik T
But I dont understand one thing, why did i receive such a long crash message instead of minor syntax error?