Issue:Crash on Postgres-based Mediawiki (patch included)

From FollowTheScore
Jump to: navigation, search
Description: SQL errors when using DPL with PostgreSQL (8.3.3) - easy to fix
Extension / Version: DPL   /   1.7.5
Type / Status: Bug   /   open

Problem

1.6.9 fails against a PostgreSQL-based wiki. Example:

 <dpl>
  category=Teams
 </dpl>

...produces:

The DPL extension (version 1.6.9) produced a SQL statement which lead to a Database error.
The reason may be an internal error of DPL or an error which you made,
especially when using DPL options like titleregexp.
Query text is:
SELECT DISTINCT page.page_namespace as page_namespace,page.page_title as page_title, REPLACE(REPLACE(CONCAT(
IF(page.page_namespace=0, , CONCAT(CASE page.page_namespace WHEN 1 THEN 'Talk' WHEN 2 THEN 'User' WHEN 3 THEN 
'User_talk' WHEN 4 THEN 'SHARCNETWiki' WHEN 5 THEN 'SHARCNETWiki_talk' WHEN 6 THEN 'Image' WHEN 7 THEN 'Image_talk' 
WHEN 8 THEN 'MediaWiki' WHEN 9 THEN 'MediaWiki_talk' WHEN 10 THEN 'Template' WHEN 11 THEN 'Template_talk' WHEN 12 
THEN 'Help' WHEN 13 THEN 'Help_talk' WHEN 14 THEN 'Category' WHEN 15 THEN 'Category_talk' END, ':')), 
page.page_title), '_', ' '),'♣','⣣') as sortkey FROM page INNER JOIN categorylinks AS cl0 ON 
page.page_id=cl0.cl_from AND (cl0.cl_to='Teams') WHERE 1=1 AND page.page_is_redirect=0 ORDER BY sortkey ASC LIMIT 0, 
500
Error message is:
ERROR: LIMIT #,# syntax is not supported HINT: Use separate LIMIT and OFFSET clauses. 

This patch (of DynamicPageList2.php) corrects the problem and it also works in MySQL (I have DLP in production use with this patch with MySQL and PostgreSQL).

2801c2801
<               $sSqlWhere .= " LIMIT $iOffset, " . intval( $iCount );
---
>               $sSqlWhere .= " OFFSET $iOffset LIMIT " . intval( $iCount );

Reply