Hi

Yesterday I updated from 1.0rc4 to 1.0 and tried to update the sql table.
But for the first time ever, I received failure messages:

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 'WHERE field = 'wid' and extra REGEXP 'auto_increment'' at line 1 query: SHOW COLUMNS FROM workflows WHERE field = 'wid' and extra REGEXP 'auto_increment' in /home/vhosts/ehsvenlo.nl/subdomains/home/httpdocs/sites/all/modules/workflow/workflow.install op regel 403.

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 'WHERE field = 'sid' and extra REGEXP 'auto_increment'' at line 1 query: SHOW COLUMNS FROM workflow_states WHERE field = 'sid' and extra REGEXP 'auto_increment' in /home/vhosts/ehsvenlo.nl/subdomains/home/httpdocs/sites/all/modules/workflow/workflow.install op regel 404.

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 'WHERE field = 'tid' and extra REGEXP 'auto_increment'' at line 1 query: SHOW COLUMNS FROM workflow_transitions WHERE field = 'tid' and extra REGEXP 'auto_increment' in /home/vhosts/ehsvenlo.nl/subdomains/home/httpdocs/sites/all/modules/workflow/workflow.install op regel 405.

Incorrect table definition; there can be only one auto column and it must be defined as a key query: ALTER TABLE drupal_workflows DROP PRIMARY KEY in /home/vhosts/ehsvenlo.nl/subdomains/home/httpdocs/includes/database.mysql-common.inc op regel 386.

Multiple primary key defined query: ALTER TABLE drupal_workflows CHANGE wid `wid` INT NOT NULL auto_increment, ADD PRIMARY KEY (wid) in /home/vhosts/ehsvenlo.nl/subdomains/home/httpdocs/includes/database.mysql-common.inc op regel 520.

Incorrect table definition; there can be only one auto column and it must be defined as a key query: ALTER TABLE drupal_workflow_states DROP PRIMARY KEY in /home/vhosts/ehsvenlo.nl/subdomains/home/httpdocs/includes/database.mysql-common.inc op regel 386.

Multiple primary key defined query: ALTER TABLE drupal_workflow_states CHANGE sid `sid` INT NOT NULL auto_increment, ADD PRIMARY KEY (sid) in /home/vhosts/ehsvenlo.nl/subdomains/home/httpdocs/includes/database.mysql-common.inc op regel 520.

Incorrect table definition; there can be only one auto column and it must be defined as a key query: ALTER TABLE drupal_workflow_transitions DROP PRIMARY KEY in /home/vhosts/ehsvenlo.nl/subdomains/home/httpdocs/includes/database.mysql-common.inc op regel 386.

Multiple primary key defined query: ALTER TABLE drupal_workflow_transitions CHANGE tid `tid` INT NOT NULL auto_increment, ADD PRIMARY KEY (tid) in /home/vhosts/ehsvenlo.nl/subdomains/home/httpdocs/includes/database.mysql-common.inc op regel 520.

Now what to do?

grtz,
Twan

Comments

jvandyk’s picture

Status: Active » Postponed (maintainer needs more info)

What database are you using, MySQL or PostgreSQL? What version of the database?

Was this installation of workflow upgraded from version 5.x or was it newly installed for 6.x?

TwanVeugelers’s picture

It's MySQL 4.1.21.

I have updated from 6.x-1.0RC4 to 6.x-1.0. And I never used Drupal 5, it was a fresh Drupal 6.5 install.

Do you need any more information?

grtz,
Twan

jeff veit’s picture

Ditto for me too.

Here's my output. The problem is missing {} brackets in SQL statements, so the table names aren't rewritten for the table names that are actually in use. Interspersed are my suggested fixes.

* user warning: Table 'hfn_dev_share.workflows' doesn't exist query: SHOW COLUMNS FROM workflows WHERE field = 'wid' and extra REGEXP 'auto_increment' in /var/www/hfnetwork-dev/sites/all/modules/workflow/workflow.install on line 403.

Suggested: $workflows = db_result(db_query("SHOW COLUMNS FROM {workflows} WHERE field = 'wid' and extra REGEXP 'auto_increment'"));
Rather than: $workflows = db_result(db_query("SHOW COLUMNS FROM workflows WHERE field = 'wid' and extra REGEXP 'auto_increment'"));

* user warning: Table 'hfn_dev_share.workflow_states' doesn't exist query: SHOW COLUMNS FROM workflow_states WHERE field = 'sid' and extra REGEXP 'auto_increment' in /var/www/hfnetwork-dev/sites/all/modules/workflow/workflow.install on line 404.

Suggested: $workflow_states = db_result(db_query("SHOW COLUMNS FROM {workflow_states} WHERE field = 'sid' and extra REGEXP 'auto_increment'"));
Original: $workflow_states = db_result(db_query("SHOW COLUMNS FROM workflow_states WHERE field = 'sid' and extra REGEXP 'auto_increment'"));

* user warning: Table 'hfn_dev_share.workflow_transitions' doesn't exist query: SHOW COLUMNS FROM workflow_transitions WHERE field = 'tid' and extra REGEXP 'auto_increment' in /var/www/hfnetwork-dev/sites/all/modules/workflow/workflow.install on line 405.

Suggested change: {Ditto}.

It looks like the following are just failures caused by the missing{}'s above.

* user warning: Incorrect table definition; there can be only one auto column and it must be defined as a key query: ALTER TABLE share_workflows DROP PRIMARY KEY in /var/www/hfnetwork-dev/includes/database.mysql-common.inc on line 386.
* user warning: Multiple primary key defined query: ALTER TABLE share_workflows CHANGE wid `wid` INT NOT NULL auto_increment, ADD PRIMARY KEY (wid) in /var/www/hfnetwork-dev/includes/database.mysql-common.inc on line 520.
* user warning: Incorrect table definition; there can be only one auto column and it must be defined as a key query: ALTER TABLE share_workflow_states DROP PRIMARY KEY in /var/www/hfnetwork-dev/includes/database.mysql-common.inc on line 386.
* user warning: Multiple primary key defined query: ALTER TABLE share_workflow_states CHANGE sid `sid` INT NOT NULL auto_increment, ADD PRIMARY KEY (sid) in /var/www/hfnetwork-dev/includes/database.mysql-common.inc on line 520.
* user warning: Incorrect table definition; there can be only one auto column and it must be defined as a key query: ALTER TABLE share_workflow_transitions DROP PRIMARY KEY in /var/www/hfnetwork-dev/includes/database.mysql-common.inc on line 386.
* user warning: Multiple primary key defined query: ALTER TABLE share_workflow_transitions CHANGE tid `tid` INT NOT NULL auto_increment, ADD PRIMARY KEY (tid) in /var/www/hfnetwork-dev/includes/database.mysql-common.inc on line 520.

To anyone having the same error: in my case the database format was correct: my original fresh install of rc4 had the right structure, and these errors didn't leave the database in a bad state. Fixing the code just meant that the it didn't generate any errors.

jvandyk’s picture

Status: Postponed (maintainer needs more info) » Active

I've committed the fix to add curly brackets and the change will appear in 6.x-1.1.

However, it seems that the SQL is not compatible with MySQL 4. It looks like we will need a different way to check if wid is an autoincrement field that works in MySQL 4.

prunelle’s picture

I have the same SQL syntax problem with SQL4 as the one you mention above (autoincrement field check). Does this affect the functionning of workflow on D6. Did anybody find a solution ?

Thanks for your answers.

Regards.

Bastlynn’s picture

Status: Active » Closed (won't fix)

Since this request is over 2 years old, I'm going to assume a solution was found or you've moved on. If not, please get updated to the latest versions of all modules and see if things have fixed themselves. If not, open a new ticket and I'll be glad to look at it.