Project

General

Profile

Actions

Bug #14616

closed

'hash' reserved word breaks typo3 when using mysql 4

Added by old_paul_xedos over 19 years ago. Updated over 19 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2005-03-17
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
3.6.0
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

usage of hash as fieldname for certain core tables in typo3.6.2 causes subsequent sql statements to fail with the error
"Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /usr/local/apache/htdocs/supportal/html/typo3_src-3.6.1/t3lib/class.t3lib_db.php on line 689"

Applying debug reveals that the SQL select statement is failing. Details below:-

caller t3lib_DB::exec_SELECTquery

ERROR You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'hash="4f0c1afe7a"' at line 4

lastBuiltQuery : SELECT *
FROM fe_session_data
WHERE
hash="4f0c1afe7a"

This probably occurs everywhere where a SQL statement refers to hash as a field name. The backend is completeley broken as a result and no logins are possible.

The above error is reproducible using the default database.sql file and mysql v4
(issue imported from #M896)

Actions #1

Updated by Ingmar Schlecht over 19 years ago

Further information about reserved words in MySQL:
http://sunsite.mff.cuni.cz/MIRRORS/ftp.mysql.com/doc/en/Reserved_words.html

At the end of that page there's a comment usggesting to place backticks (`name`) around the table and column names. Karsten, would that be a universal solution?

- Ingmar

Actions #2

Updated by Karsten Dambekalns over 19 years ago

Well, this isn't a universal solution. The use of backticks is MySQL-specific, all other databases and the SQL standard use double quotes for this purpose (quoting identifiers).

The questions is, do we really see a bug here? According to http://dev.mysql.com/doc/mysql/en/reserved-words.html hash is not a reserved word, and I didn't have such a problem in any of the setups I did (Using 3.23.x and 4.0.x). So, could the version number please be more specific?

I will have to check what happens to DBAL if we add backticks to the dump files. Another way might be to add the backticks in the install tool when running natively on MySQL.

Actions #3

Updated by Karsten Dambekalns over 19 years ago

This never really was a bug in TYPO3, it seems. Have a look at this MySQL bug #724 (http://bugs.mysql.com/bug.php?id=724).

Actions

Also available in: Atom PDF