ALTER TABLE {blocks} ADD types text
And I've got the following problem when upgrading from 4.5.0 to 4.6.0. Update.php reported the problem:
user 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 'types text' at line 1
query: ALTER TABLE blocks ADD types text in /usr/local/www/data/ranat_tmp/includes/database.mysql.inc on line 66.
ALTER TABLE {blocks} ADD types text
FAILED
After that drupal seemed to be working. But when I entered Block menu I got errors like:
user 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 'types) VALUES ('archive', '0', 0, 0, 0, 0, '', 0, 0, '')' at li
query: INSERT INTO blocks (module, delta, status, weight, region, visibility, pages, custom, throttle, types) VALUES ('archive', '0', 0, 0, 0, 0, '', 0, 0, '') in /usr/local/www/data/ranat_tmp/includes/database.mysql.inc on line 66.
and all the block disappeared from the site. No administration menu, no menus at all. (I had backups of course). Errors apear because 'types' field was not created by update.php. I tried to add the field manualy with phpmyadmin - all the same.
So why did update.php failed to alter 'blocks' table?

Still remains
I made a clean installation of 4.5.2 and tried to update to 4.6.0 - the same problem:
ALTER TABLE {blocks} ADD types text
FAILED
solution?
I've fixed the problem but I'm not sure it's all right. What I did:
As update.php can't add "types" field to "blocks" table I added it manually with phpmyadmin.
When entering blocks panel I get errors for query:
INSERT INTO blocks (module, delta, status, weight, region, visibility, pages, custom, throttle, types) VALUES ('archive', '0', 0, 0, 0, 0, '', 0, 0, '')
It's because mysql considers word "types" being a special keyword. So quoted this word in /modules/block.module line 163:
INSERT INTO blocks (module, delta, status, weight, region, visibility, pages, custom, throttle, `types`) VALUES ('archive', '0', 0, 0, 0, 0, '', 0, 0, '')
And now it's working! But I'm not sure I fixed it correctly so I'm not upgradint my working site now. Have anyone seen the same?
My MySQL is 4.1.1
My PHP is 4.3.11
MySQL 4.1
This is a known issue that only affects users with MySQL versions 4.1.0 and 4.1.1 (apparently). A quick solution is to quote the field name in backquotes, as thest has done.
Thanks
But now I see that there are a lot of other queries where "types" is not quoted. I can't be sure I fixed them all. Are developers going to fix it?
Thanks
I can see, that the solution is to quote all "types" manualy or to upgrade MySql. I'd better prefer waiting for next Drupal release. Hope it will be soon and the problem will be fixed.
still need help...
I guess I have the same problem. All my blocks are gone and my mysql table "blocks" is empty. What ist supposed to be in there? Can i fill it up manualy?
I made my Last backup before the upgrade and I don't want to upgrade again...
Thanks
To fix manually:
1. You should add the field "types" manualy to "blocks" table. The SQL is:
ALTER TABLE `blocks` ADD `types` text;
2. Everywhere in the source where "types" field is present in SQL queries you should quote it like this: `types`. For example in /modules/block.module line 163:
INSERT INTO blocks (module, delta, status, weight, region, visibility, pages, custom, throttle, types) VALUES ('archive', '0', 0, 0, 0, 0, '', 0, 0, '')
should be:
INSERT INTO blocks (module, delta, status, weight, region, visibility, pages, custom, throttle, `types`) VALUES ('archive', '0', 0, 0, 0, 0, '', 0, 0, '')
Also in line 265
types = '%s'
replace with
`types` = '%s'
and in line 274
custom, types FROM
replace with
custom, `types` FROM
Should work now. Go to Blocks menu and turn your blocks on.
But maybe you'll have to quote "types" somewhere else.
how do i do that?
how do i do that?
Changed Table
I found that even after I backtic'ed all of the types fields, I continued to recieve errors. I found that I was missing a `visibility` tinyint(1) column in the database, and that the `path` column has been renamed to `pages` - I manually changed these in the database and it worked.
how you did theses changes?
how you did theses changes? what files did you change? i´m freaking out
Thanks for sharing theses
Thanks for sharing
theses