Database queries fail during update-process
motto - November 20, 2008 - 02:41
| Project: | Quotes |
| Version: | 6.x-1.21 |
| Component: | Upgrading |
| Category: | support request |
| Priority: | normal |
| Assigned: | NancyDru |
| Status: | closed |
Jump to:
Description
Hi folks,
I updated Quotes from 1.19 to 1.21 on a D6.6 installation. This error occurred to me while I updated the database:
The following queries were executed
quotes module
Update #6105
* Failed: ALTER TABLE {quotes_blocks} ADD `aid_filter` TEXT DEFAULT NULL
* Failed: ALTER TABLE {quotes_blocks} CHANGE aid_filter `aid_filter` TEXT NOT NULLThanks for developing this great module!
Matt

#1
I don't suppose you saved off the real error messages?
#2
Hi NancyDru,
I just ran the same queries (update #6105) again. The first error occurs only because I ran it more than once. The second though is exactly the same I got the first time.
* user warning: Duplicate column name 'aid_filter' query: ALTER TABLE quotes_blocks ADD `aid_filter` TEXT DEFAULT NULL in C:\Inetpub\wwwroot\Gnosis\includes\database.mysql-common.inc on line 298.* user warning: Data truncated for column 'aid_filter' at row 1 query: ALTER TABLE quotes_blocks CHANGE aid_filter `aid_filter` TEXT NOT NULL in C:\Inetpub\wwwroot\Gnosis\includes\database.mysql-common.inc on line 520.
#3
I don't understand why there are two ALTERs showing; the update code has only one.
The MySql manual doesn't give me much information on what "data truncated" means. I don't see how you can have any data to truncate when you just added the column.
Is the module working fine otherwise?
#4
Nancy,
This is because you cannot add a column that has default set to NULL in a column defined as NOT NULL if the table is not empty.
So Drupal adds the column with DEFAULT NULL, sets a default (which you do not define... but I do not know whether that is a problem since the first ALTER already fails...) and then alters the column to NOT NULL.
It seems to me that the name of the column should not have quotes, but maybe MySQL requires the quotes. And anyway your code looks fine. It would be a Drupal DB problem.
Thank you.
Alexis
#5
I'm not even sure if NULL/NOT NULL is even a real issue here. If so, it can be manually changed.
I, too, don't know whether the back ticks are really required, but I assume that the Drupal developers tested this fairly well. Since I used a standard Drupal API call, I'm not sure what else I can do.
It's interesting that I can add an identical field manually with PhpMyAdmin and I only see one command issued.
#6
http://drupal.org/node/159329
I committed this fix. You will need to rerun update_6105.
#7
Nancy,
That's close to what I was saying. They have an 'initial' that sets a default value. 8-)
Thank you for the link.
Alexis
#8
Automatically closed -- issue fixed for two weeks with no activity.