[Clipart] Openclipart.org shows database error

Stephan Beal stephan at wanderinghorse.net
Wed Jul 11 08:50:01 PDT 2007


On Wednesday 11 July 2007, momo wrote:
> That's exactly what I've been told by a web programmer friend: it is
> quite possible that there are queries that aren't supported by an
> older MySQL version on the osuosl server. Was the old server running
> a newer database version?

Hiya!

This error has nothing to do directly with the db version, but the db 
schema. The query clearly uses a field named INF which is not actually 
in the db table being queried. The error says:

>>> A database error has occurred
>>> Query: SELECT `ip` FROM `mw_bad_behavior_log` WHERE `ip` LIKE
>>> '127.0.0.1' AND `http_response` = 403 AND `date` >
>>> DATE_SUB('2007-07-10 22:05:19', INTERVAL INF MINUTE)

The query is just plain broken - it's refering to a field which is not 
defined in the query. According to the docs for DATE_SUB/DATE_ADD:

http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-add

INF field is used, there should a number should be. In this case it's 
referring to a field. Normally that would be legal (assuming the field 
is numeric), but the field doesn't exist. For example, the following 
works:

mysql> select DATE_SUB('2007-07-10 22:05:19', INTERVAL 1 MINUTE);
+----------------------------------------------------+
| DATE_SUB('2007-07-10 22:05:19', INTERVAL 1 MINUTE) |
+----------------------------------------------------+
| 2007-07-10 22:04:19                                |
+----------------------------------------------------+
1 row in set (0.08 sec)

So the trick now is to find out:

a) is that INF reference REALLY needed?

b) If it IS needed, how does the query (or db table) need to change to 
make the INF field valid?

c) If it ISN'T needed, can it be replaced with a hard-coded number?

:)

-- 
----- stephan beal
http://www.wanderinghorse.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/clipart/attachments/20070711/c2bb2db7/attachment.pgp>


More information about the clipart mailing list