Wikitools not compatible with PostgreSQL?
stodge - May 25, 2009 - 12:45
| Project: | Wikitools |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
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.

#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
here's a patch, not sure if its the complete fix but it fixes what is outlined above.
#4
I will review the path.
#5
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
Here is an updated patch which also fix the other error I mentioned in comment #5.
#7
looks good, I'm happy :)
#8
Thanks, committed and should be fixed on the development branch.
#9
Automatically closed -- issue fixed for 2 weeks with no activity.