Remove temporary table from comment.install

chx - November 6, 2007 - 18:13
Project:Drupal
Version:6.x-dev
Component:comment.module
Category:task
Priority:critical
Assigned:chx
Status:closed
Description

http://dev.mysql.com/doc/refman/4.1/en/insert-select.html

Prior to MySQL 4.0.14, the target table of the INSERT statement cannot appear in the FROM clause of the SELECT part of the query. This limitation is lifted in 4.0.14.

We require MySQL 4.1.

AttachmentSizeStatusTest resultOperations
db_temp_table_joins_lock_table_in_the_grave.patch962 bytesIgnoredNoneNone

#1

catch - November 6, 2007 - 18:16

#189832 was duplicate, yay!

#2

FiReaNG3L - November 6, 2007 - 18:40

Make perfect sense to me; I wasn't even aware of that limitation in pre 4.1 MySQL.

#3

catch - November 6, 2007 - 20:00
Status:needs review» reviewed & tested by the community

disabled comment module.
Posted a node - no record made in node_comment_statistics
applied the patch
enabled comment module
node_comment_statistics was updated, and the values were all fine.

Bye bye then.

#4

chx - November 7, 2007 - 06:52

To continue the quote from MySQL manual

In this case, MySQL creates a temporary table to hold the rows from the SELECT and then inserts those rows into the target table.

I just tested that INSERT...SELECT works into the same table with just INSERT and SELECT grants. So while the manual says there is a temporary table being made that's behind the scenes, somewhat similar to the well known fact that some ordinary SELECTs result in a temporary table (and when those get on disk, your performance plumets).

#5

Gábor Hojtsy - November 7, 2007 - 09:59
Status:reviewed & tested by the community» needs review

Who tested this on PostgreSQL?

#6

chx - November 7, 2007 - 13:01
Status:needs review» reviewed & tested by the community

Me.

test=# create table boo (foo int);
CREATE TABLE
test=# insert into boo values (1);
INSERT 0 1
test=# insert into boo values (2);
INSERT 0 1
test=# insert into boo select * from boo;
INSERT 0 2
test=# select * from boo;
foo
-----
   1
   2
   1
   2
(4 rows)

#7

Gábor Hojtsy - November 7, 2007 - 15:55
Status:reviewed & tested by the community» fixed

OK, committed, thanks.

#8

Anonymous - November 21, 2007 - 16:04
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.