Problem
[lang_de]Einige Hoster geben – wahrscheinlich wegen des momentanen Vollmondes – das MySQL Recht CREATE TEMPORARY TABLES nicht an ihre Kunden. Drupal möchte das leider und so muss man es umgehen 🙁 …
Bei der Installation beispielsweise wird gemeldet:[/lang_de]
[lang_en]
Some hosting providers do not grant the MySQL-userright CREATE TEMPORARY TABLES to their customers. Maybe because it’s full moon at the moment and everyone seems a bit crazy. But a href=“http://drupal.org/“>Drupal really wants this right and so a workaround is needed 🙁 …
The error during the installation could be something like this:[/lang_en]
user warning: Access denied for user: 'drupal@%' to database 'drupal' query: CREATE
TEMPORARY TABLE missing_nids SELECT n.nid, n.created, n.uid FROM node n LEFT
JOIN node_comment_statistics c ON n.nid = c.nid WHERE c.comment_count IS NULL in
/var/websites/drupal/includes/database.mysql.inc on line 167.
[lang_de]
Eine Art Lösung
Ich habe für Drupal 5.2 einen Patch erstellt der das Problem lösen sollte. CREATE TEMPORARY TABLES ist in Drupal vorbildlich in eine einzige Funktion db_query_temporary in der Datei includes/database.mysql.inc ausgelagert. Grundsätzlich erstellt dieser Patch statt einer temporären eine richtige Tabelle, deren Erstellungsdatum in einer weiteren Tabelle mit Namen temporary_table gespeichert wird. cron.php entfernt diese dann regelmässig. Sollte die Tabelle schon existieren bei der Erstellung, wird sie vorgängig gelöscht.
Das Ganze funktioniert nur für MySQL und MySQLI und bedeutet einen enormen Geschwindigkeitsverlust. Ich habe den Patch nur bei einer low-traffic Site getestet und weiss nicht, ob es vielleicht noch Race-Conditions geben könnte. Benutzung also auf eigene Gefahr.[/lang_de]
[lang_en]
Kind of a Solution
I have written a patch for Drupal 5.2 which should kinda solve the problem. In Drupal, CREATE TEMPORARY TABLES is only used in the db_query_temporary function, found in the file includes/database.mysql.inc, which is a very clean progamming style! Basically, this patch creates a real table instead of a temporary one. The name and the creationdate is stored in an extra table called temporary_table. The cron.php removes these tables on a regular base. If the table already exists, it is dropped.
This patch only works for MySQL and MySQLI and may be a performance loss. I have tested this patch only on a low traffic site and I do not know if there are race conditions. Use it on your own risk…
Addendum
Another solution has been posted at Drupal.org.
[/lang_en]
[lang_en]Here it is: Patch to use Drupal without the CREATE TEMPORARY TABLES.
To apply it, change into the Drupal base directory and issue patch -p0<drupalwotemptables.patch on the commandline.[/lang_en]
[lang_de]Und hier ist er: Patch für Drupal ohne CREATE TEMPORARY TABLES.
Um ihn anzuwenden ins Basisverzeichnis wechseln und patch -p0<drupalwotemptables.patch ausführen.
Nachschlag
Eine weitere Lösung wurde bei Drupal geposted.
[/lang_de]