Looks like Wikitools isn't compatible with PostgreSQL:

warning: pg_query() [function.pg-query]: Query failed: ERROR: column "_" does not exist in /var/www/html/includes/database.pgsql.inc on line 139.
user warning: query: SELECT COUNT(DISTINCT(n1.nid)) FROM node n1, node n2 WHERE LOWER(REPLACE(n1.title, "_", " ")) = LOWER(REPLACE(n2.title, "_", " ")) AND n1.nid != n2.nid AND n1.type IN('page','story') AND n2.type IN('page','story') in /var/www/html/sites/all/modules/wikitools/wikitools.admin.inc on line 17.

This occurred when I tried to modify the admin settings for this module.

CommentFileSizeAuthor
#6 472188.patch1.47 KBroychri
#3 fix-wikitools-1.patch965 bytesjosh waihi

Comments

cwgordon7’s picture

Hm. This is a problem. I'm not sure what's wrong. PostgreSQL people, any help?

Side note: this should only affect you on the duplicate node page?

illmnec’s picture

I fixed this bug locally by editing /var/www/html/sites/all/modules/wikitools/wikitools.admin.inc and changing the " to ' and the surrounding ' to " in lines 154, 155, 158 and 159.

Thus,

    if (wikitools_treat_underscore_as_space()) {
      $n1_title = 'REPLACE(". $n1_title .", "_", " ")';
      $n2_title = 'REPLACE(". $n2_title .", "_", " ")';
    }
    if (wikitools_treat_dash_as_space()) {
      $n1_title = 'REPLACE(". $n1_title .", "-", " ")';
      $n2_title = 'REPLACE(". $n2_title .", "-", " ")';
    }

Became

    if (wikitools_treat_underscore_as_space()) {
      $n1_title = "REPLACE('. $n1_title .', '_', ' ')";
      $n2_title = "REPLACE('. $n2_title .', '_', ' ')";
    }
    if (wikitools_treat_dash_as_space()) {
      $n1_title = "REPLACE('. $n1_title .', '-', ' ')";
      $n2_title = "REPLACE('. $n2_title .', '-', ' ')";
    }

I am not sure but this might break the MySQL side of things.

josh waihi’s picture

Version: 6.x-1.1 » 6.x-1.2
StatusFileSize
new965 bytes

here's a patch, not sure if its the complete fix but it fixes what is outlined above.

roychri’s picture

Status: Active » Needs review

I will review the path.

roychri’s picture

Status: Needs review » Needs work

After I applied this patch, the error was gone but another one appeared.

    * warning: pg_query() [function.pg-query]: Query failed: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list in /var/html/drupal-6.13/includes/database.pgsql.inc on line 139.
    * user warning: query: SELECT DISTINCT(n1.nid) FROM node n1, node n2 WHERE LOWER(REPLACE(n1.title, '_', ' ')) = LOWER(REPLACE(n2.title, '_', ' ')) AND n1.nid != n2.nid AND n1.type IN('wiki') AND n2.type IN('wiki') ORDER BY n1.title ASC LIMIT 10 OFFSET 0 in /var/html/drupal-6.13/sites/all/modules/contrib/wikitools/wikitools.admin.inc on line 129.

According to this thread: http://archives.postgresql.org/pgsql-sql/2007-02/msg00161.php
The SQL statement is incorrect.

roychri’s picture

Status: Needs work » Needs review
StatusFileSize
new1.47 KB

Here is an updated patch which also fix the other error I mentioned in comment #5.

josh waihi’s picture

Status: Needs review » Reviewed & tested by the community

looks good, I'm happy :)

cwgordon7’s picture

Version: 6.x-1.2 » 6.x-1.x-dev
Status: Reviewed & tested by the community » Fixed

Thanks, committed and should be fixed on the development branch.

Status: Fixed » Closed (fixed)

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