I've seen an issue installing the friendlist module. Specifically, I get an error for two lines of data insertion into tables. The errors are (see attached as well):

* warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near "set" LINE 1: ...INTO foology_org_drupal_friendlist_relation_types set name='... ^ in /sites/data/_share/drupal-6.6/includes/database.pgsql.inc on line 138.
* user warning: query: INSERT INTO foology_org_drupal_friendlist_relation_types set name='friend', name_p='friends', oneway=0, active=1 in /sites/data/_share/drupal-6.6/sites/foology.org/modules/friendlist/friendlist_api/friendlist_api.install on line 234.
* warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near "set" LINE 1: ...INTO foology_org_drupal_friendlist_relation_types set name='... ^ in /sites/data/_share/drupal-6.6/includes/database.pgsql.inc on line 138.
* user warning: query: INSERT INTO foology_org_drupal_friendlist_relation_types set name='fan', name_p='fans', oneway=1, active=1 in /sites/data/_share/drupal-6.6/sites/foology.org/modules/friendlist/friendlist_api/friendlist_api.install on line 244.

This is using only core modules and modules required by friendlist. I think the issue is some kind of "MySQLism" as I am seeing the error on a PostgreSQL 5.2 database and the INSERTs seem to be bypassing the Drupal DB abstraction. The offending lines are from .../friendlist/friendlist_api/friendlist_api.install and go like this:

  // ...
  #$r1 = drupal_write_record('friendlist_relation_types', $record1);
  db_query("INSERT INTO {friendlist_relation_types} set name='%s', name_p='%s', oneway=%d, active=%d", $record1->name, $record1->name_p, $record1->oneway, $record1->active);
  // ...
  #$r2 = drupal_write_record('friendlist_relation_types', $record2);
  db_query("INSERT INTO {friendlist_relation_types} set name='%s', name_p='%s', oneway=%d, active=%d", $record2->name, $record2->name_p, $record2->oneway, $record2->active);
  // ...

I didn't try uncommenting the $r1 and $r2 lines instead to see if that worked. This is using the dev snapshot of friendlist from 2008 Nov. 19 on Drupal 6.6. I see similar results if I try to manually Add relation type to add the relations which should be defined by default (fan and friend).

Comments

jaydub’s picture

Friendlist uses MySQL-only INSERT syntax which is why this error is occuring. See http://dev.mysql.com/doc/refman/5.1/en/extensions-to-ansi.html for differences from ANSI SQL.

I'm readying a patch that addresses these problems as I ran into all of them testing with PostgreSQL as well.

jaydub’s picture

mercmobily’s picture

Status: Active » Fixed

Hi,

I applied the patch, it should all work now...
Thanks!

Merc.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.