When editing a node (any node) the following error message is presented:

You have an error in your SQL syntax near &#039;USING(type_name, group_name) JOIN node_field_instance fi USING(field_name, type_&#039; at line 1 query: SELECT fi.*, g.group_name FROM node_group g JOIN node_group_fields f USING(type_name, group_name) JOIN node_field_instance fi USING(field_name, type_name) ORDER BY fi.weight in <my path>/includes/database.mysql.inc on line 167.

I have tracked this down to fieldgroup_groups() in fieldgroup.module. It seems my version of MySQL does not like the following:

      $result = db_query("SELECT fi.*, g.group_name FROM {node_group} g ".
                         "JOIN {node_group_fields} f USING(type_name, group_name) ".
                         "JOIN {node_field_instance} fi USING(field_name, type_name) ".
                         "ORDER BY fi.weight");

I have seen this before - in date.module a couple of days ago. It seems that MySQL doesn't like the JOIN's (not sure why yet) looks like you have to give it an INNER or OUTER.

I am using MySQL v3.23.56.

CommentFileSizeAuthor
#5 fieldgroup.patch1.12 KBRobRoy
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

RobRoy’s picture

Title: mySQL error on node edit » Change USING() to explicitly list joins for better MySQL compatibility

IIRC MySQL 3 can't use USING. For posterity we should just explicitly list the joins. Can't patch now, maybe later.

RobRoy’s picture

Oh, and explicitly specify the INNER JOIN.

kmv’s picture

I don't know about all of v3, but v3.23.x does support USING.

I can confirm that explicitly specifying INNER JOIN does fix the problem. Thanks.

RobRoy’s picture

Title: Change USING() to explicitly list joins for better MySQL compatibility » Specify "INNER" JOIN and scrap USING() for better MySQL compatibility

Yeah, I did a little more digging and you're right. It's the JOIN that's a problem.

I think we should scrap USING anyways as it's not really used in any other code and it may make fieldgroup more SQL-compliant.

RobRoy’s picture

Status: Active » Needs review
FileSize
1.12 KB

Here's a patch.

KarenS’s picture

Status: Needs review » Fixed

Fixed. Forgot to give you credit in the commit for the patch though. Sorry!

Anonymous’s picture

Status: Fixed » Closed (fixed)