A db columns in linkchecker module is named 'update'. I tried to rename this column to changed, but the ALTER in update.php fails every time.

  db_change_field($ret, 'linkchecker_tasks', 'update', 'changed', array('type' => 'int', 'not null' => TRUE, 'default' => 0));

Error:

user warning: 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 'update `changed` INT NOT NULL DEFAULT 0' at line 1 query: ALTER TABLE linkchecker_tasks CHANGE update `changed` INT NOT NULL DEFAULT 0 in includes\database.mysql-common.inc on line 520.

So I've added curly quotes to the `update` column and executed it by hand what worked.

ALTER TABLE linkchecker_tasks CHANGE `update` `changed` INT NOT NULL DEFAULT 0

To get the module fixed I need to use the SQL statement and cannot use db_change_field(). I think core should also be able to handle reserved names.

CommentFileSizeAuthor
#1 dbchangefield-reserved-words.patch858 bytesJorrit

Comments

Jorrit’s picture

Status: Active » Needs review
StatusFileSize
new858 bytes

The original field name is not enclosed with backticks. The attached patch fixes this.

Jorrit’s picture

Status: Needs review » Closed (duplicate)