Fix a QUERY using an invalid GROUP BY clause
git-svn-id: https://plugins.svn.wordpress.org/postgresql-for-wordpress/trunk@195528 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
@@ -131,6 +131,7 @@
|
|||||||
if( false !== strpos($sql, 'SQL_CALC_FOUND_ROWS'))
|
if( false !== strpos($sql, 'SQL_CALC_FOUND_ROWS'))
|
||||||
{
|
{
|
||||||
$catchnumrows = true;
|
$catchnumrows = true;
|
||||||
|
$sql = str_replace('GROUP BY '.$table_prefix.'posts."ID"', '' , $sql);
|
||||||
$sql = str_replace('SQL_CALC_FOUND_ROWS', 'DISTINCT', $sql);
|
$sql = str_replace('SQL_CALC_FOUND_ROWS', 'DISTINCT', $sql);
|
||||||
$GLOBALS['pg4wp_numrows'] = preg_replace( '/SELECT DISTINCT.+FROM ('.$table_prefix.'posts)/', 'SELECT DISTINCT "ID" FROM $1', $sql);
|
$GLOBALS['pg4wp_numrows'] = preg_replace( '/SELECT DISTINCT.+FROM ('.$table_prefix.'posts)/', 'SELECT DISTINCT "ID" FROM $1', $sql);
|
||||||
$GLOBALS['pg4wp_numrows'] = preg_replace( '/SELECT(.+)FROM/', 'SELECT COUNT($1) FROM', $GLOBALS['pg4wp_numrows']);
|
$GLOBALS['pg4wp_numrows'] = preg_replace( '/SELECT(.+)FROM/', 'SELECT COUNT($1) FROM', $GLOBALS['pg4wp_numrows']);
|
||||||
|
Reference in New Issue
Block a user