Download & Extend

Wikitools not compatible with PostgreSQL?

Project:Wikitools
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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.

Comments

#1

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?

#2

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.

#3

Version:6.x-1.1» 6.x-1.2

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

AttachmentSize
fix-wikitools-1.patch 965 bytes

#4

Status:active» needs review

I will review the path.

#5

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.

#6

Status:needs work» needs review

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

AttachmentSize
472188.patch 1.47 KB

#7

Status:needs review» reviewed & tested by the community

looks good, I'm happy :)

#8

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.

#9

Status:fixed» closed (fixed)

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

nobody click here